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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px 0;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title .icon {
    font-size: 3rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Card Styles */
.search-card,
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

/* Form Styles */
.tracking-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group select,
.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group select {
    cursor: pointer;
}

/* Button Styles */
.btn-primary,
.btn-secondary {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Loading Spinner */
.spinner,
.spinner-large {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner {
    width: 20px;
    height: 20px;
}

.spinner-large {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Error State */
.error-card {
    text-align: center;
    padding: 40px 20px;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.error-card h3 {
    color: var(--error-color);
    margin-bottom: 10px;
}

.error-card p {
    color: var(--text-secondary);
}

/* Result State */
.tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

.tracking-info h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.waybill-number,
.courier-name,
.tracking-status {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.label {
    font-weight: 500;
    color: var(--text-secondary);
}

.value {
    color: var(--text-primary);
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--success-color);
    color: white;
}

.status-badge.pending {
    background: var(--warning-color);
}

.status-badge.failed,
.status-badge.cancelled {
    background: var(--error-color);
}

/* Address Section */
.address-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: start;
}

.address-box {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
}

.address-box h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.address-box div {
    color: var(--text-secondary);
    line-height: 1.8;
}

.arrow {
    font-size: 2rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

/* History Section */
.history-section {
    margin-top: 30px;
}

.history-section h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.history-item:first-child {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.history-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
}

.history-note {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.history-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-time {
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 20px 0;
    opacity: 0.8;
}

.footer a {
    color: white;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .title .icon {
        font-size: 2.5rem;
    }

    .search-card,
    .result-card {
        padding: 20px;
    }

    .tracking-header {
        flex-direction: column;
    }

    .address-section {
        grid-template-columns: 1fr;
    }

    .arrow {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .history-meta {
        flex-direction: column;
        gap: 5px;
    }
}
