/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --primary-dark: #0052a3;
    --secondary-color: #00b4d8;
    --accent-color: #ff6b35;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #f8f9fa;
    --dark-color: #2c3e50;
    --gray-color: #95a5a6;
    --border-radius: 12px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    color: var(--dark-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Header Styles ===== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M0,0 L100,0 L100,100" fill="white" opacity="0.05"/></svg>');
    background-size: 100px 100px;
}

.logo-container {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.sf-logo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: contain;
    border: 4px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
    background: white;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.sf-logo:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.logo-hint {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.logo-container:hover .logo-hint {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #e3f2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 10px;
    font-weight: 300;
    letter-spacing: 1px;
}

/* ===== Main Content ===== */
main {
    padding: 40px;
}

.tracking-section, .result-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.tracking-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
}

h2 {
    color: var(--dark-color);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.8rem;
    font-weight: 700;
}

h2 i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* ===== Form Styles ===== */
.tracking-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 30px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
}

label i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

input, textarea, select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
    font-family: inherit;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
    transform: translateY(-2px);
}

input:hover, textarea:hover, select:hover {
    border-color: #c0cad8;
}

.hint {
    display: block;
    margin-top: 8px;
    color: var(--gray-color);
    font-size: 0.9rem;
    font-style: italic;
}

/* ===== Button Styles ===== */
.track-btn, .new-search-btn, .login-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.track-btn::before, .new-search-btn::before, .login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.track-btn:hover::before, .new-search-btn:hover::before, .login-btn:hover::before {
    left: 100%;
}

.track-btn:hover, .new-search-btn:hover, .login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 102, 204, 0.2);
}

.track-btn:active, .new-search-btn:active, .login-btn:active {
    transform: translateY(-1px);
}

.new-search-btn {
    max-width: 300px;
    margin: 40px auto 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.new-search-btn:hover {
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.2);
}

/* ===== Result Section ===== */
.shipment-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.info-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    border-top: 4px solid var(--primary-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.info-card:hover::before {
    transform: translateX(0);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.info-card.full-width {
    grid-column: 1 / -1;
}

.info-card h3 {
    color: var(--dark-color);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 700;
}

.info-card h3 i {
    color: var(--primary-color);
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid #edf2f7;
    transition: var(--transition);
}

.info-item:hover {
    border-bottom-color: var(--primary-color);
}

.label {
    font-weight: 600;
    color: var(--dark-color);
    min-width: 160px;
    font-size: 1.05rem;
}

.value {
    color: var(--dark-color);
    text-align: right;
    flex: 1;
    word-break: break-word;
    font-weight: 500;
}

.status {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 25px;
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid white;
    box-shadow: 0 0 0 4px var(--secondary-color);
    z-index: 2;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-date {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.timeline-content {
    color: var(--dark-color);
    font-weight: 500;
    line-height: 1.5;
}

.timeline-location {
    color: var(--gray-color);
    font-style: italic;
    margin-top: 5px;
    font-size: 0.9rem;
}

/* ===== Error Message ===== */
.error-message {
    background: linear-gradient(135deg, #fee 0%, #ffeaea 100%);
    border-left: 4px solid var(--danger-color);
    padding: 25px;
    border-radius: var(--border-radius);
    color: var(--danger-color);
    font-weight: 600;
    text-align: center;
    margin-top: 30px;
    box-shadow: var(--box-shadow);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== Footer ===== */
footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 30px;
    text-align: center;
    color: white;
}

footer p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-note {
    font-size: 0.95rem;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 25px 30px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.close {
    font-size: 32px;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.error-field {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin-top: 8px;
    min-height: 20px;
    font-weight: 500;
}

/* ===== Admin Page Styles ===== */
.admin-container {
    padding: 30px 40px 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    min-height: 70vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 25px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.admin-header h2 {
    color: var(--dark-color);
    margin: 0;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.tab-btn {
    padding: 15px 30px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    width: 100%;
}

.tab-btn:hover:not(.active) {
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    color: var(--dark-color);
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: 700;
}

/* ===== Shipping Form ===== */
.shipping-form {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.shipping-form h4 {
    color: var(--dark-color);
    margin: 30px 0 20px;
    font-size: 1.3rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.form-actions {
    display: flex;
    gap: 20px;
    margin-top: 40px;
}

/* ===== Button Styles for Admin ===== */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 140px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #27ae60 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c0392b 100%);
    color: white;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 14px;
    min-width: auto;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(-1px);
}

/* ===== Table Styles ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: white;
    margin-top: 20px;
}

.shipping-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.shipping-table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shipping-table td {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

.shipping-table tr {
    transition: var(--transition);
}

.shipping-table tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    transform: scale(1.002);
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.status-in-transit {
    background: linear-gradient(135deg, #cce5ff 0%, #a8d5ff 100%);
    color: #004085;
}

.status-customs {
    background: linear-gradient(135deg, #d4edda 0%, #c1e7cb 100%);
    color: #155724;
}

.status-delivered {
    background: linear-gradient(135deg, #d1ecf1 0%, #b9e3ea 100%);
    color: #0c5460;
}

/* ===== Update Modal Specific ===== */
#updateModal .modal-content {
    max-width: 600px;
    animation: modalSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#updateModal .modal-body {
    padding: 30px;
}

.form-control {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 16px;
    transition: var(--transition);
    margin-bottom: 20px;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
    transform: translateY(-2px);
}

/* ===== Loading Spinner ===== */
.loading {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 102, 204, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Flag Icons ===== */
.flag-icon {
    font-size: 1.2rem;
    margin-right: 8px;
}

/* ===== Action Buttons Container ===== */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
        margin: -20px;
        box-shadow: none;
    }
    
    header {
        padding: 30px 20px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .shipment-info {
        grid-template-columns: 1fr;
    }
    
    .info-item {
        flex-direction: column;
        gap: 8px;
    }
    
    .value {
        text-align: left;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .admin-container {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .admin-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .tab-btn {
        width: 100%;
        justify-content: center;
    }
    
    .shipping-form {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .tracking-section, .result-section {
        padding: 25px 20px;
    }
    
    .sf-logo {
        width: 70px;
        height: 70px;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .timeline {
        padding-left: 25px;
    }
    
    .timeline::before {
        left: 8px;
    }
    
    .timeline-item {
        padding-left: 20px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .container {
        box-shadow: none;
        margin: 0;
    }
    
    .track-btn, .new-search-btn, .admin-tabs, .form-actions {
        display: none;
    }
}
