/* Mobile Delivery Interface Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--sa-font);
    background: var(--sa-bg);
    color: var(--sa-text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.delivery-container {
    min-height: 100vh;
    padding: 0;
    max-width: 100%;
    margin: 0;
    background: var(--sa-bg);
}

/* Header */
.delivery-header {
    background: var(--sa-surface);
    border-bottom: 1px solid var(--sa-border);
    padding: 15px 20px;
    box-shadow: var(--sa-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.delivery-header h1 {
    font-family: var(--sa-font);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sa-text);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.delivery-header h1 i {
    color: var(--sa-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Unified icon-only header buttons */
.delivery-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius-sm);
    background: var(--sa-primary-soft);
    color: var(--sa-primary);
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.delivery-header-btn:hover {
    background: var(--sa-primary);
    border-color: var(--sa-primary);
    color: white;
}

.delivery-header-btn:active {
    transform: scale(0.95);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn-icon {
    background: var(--sa-primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--sa-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--sa-shadow);
}

.btn-icon:active {
    transform: scale(0.95);
    background: var(--sa-primary-hover);
}

.btn-secondary {
    background: var(--sa-surface);
    color: var(--sa-text-muted);
    border: 1px solid var(--sa-border);
    padding: 10px 16px;
    border-radius: var(--sa-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--sa-primary-soft);
    border-color: var(--sa-primary);
    color: var(--sa-primary);
}

.auto-refresh-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--sa-text-muted);
}

.auto-refresh-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Orders Container */
.orders-container {
    padding: 15px;
    padding-bottom: 80px;
}

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

.delivery-order-card {
    background: var(--sa-surface);
    border-radius: var(--sa-radius);
    padding: 18px;
    box-shadow: var(--sa-shadow-md);
    transition: all 0.3s ease;
    border-left: 4px solid var(--sa-primary);
}

.delivery-order-card:active {
    transform: scale(0.98);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--sa-border);
}

.order-number {
    font-family: var(--sa-font);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--sa-text);
}

.order-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sa-text-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.order-time i {
    color: var(--sa-text-subtle);
}

.order-customer-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sa-text);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--sa-primary-soft);
    border-radius: var(--sa-radius-sm);
    border-left: 3px solid var(--sa-primary);
}

.order-customer-name i {
    color: var(--sa-primary);
    font-size: 1.2rem;
}

.order-customer-name strong {
    color: var(--sa-text);
    font-weight: 700;
}

/* Delivery Address */
.delivery-address {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: var(--sa-bg);
    border-radius: var(--sa-radius-sm);
}

.address-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--sa-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.address-details {
    flex: 1;
    min-width: 0;
}

.address-street {
    font-weight: 600;
    color: var(--sa-text);
    font-size: 1rem;
    margin-bottom: 4px;
    word-break: break-word;
}

.address-city {
    color: var(--sa-text-muted);
    font-size: 0.9rem;
}

.address-action {
    flex-shrink: 0;
}

.btn-maps {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--sa-info);
    color: white;
    text-decoration: none;
    border-radius: var(--sa-radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--sa-shadow);
}

.btn-maps:active {
    transform: scale(0.95);
    opacity: 0.9;
}

.btn-maps i {
    font-size: 1.1rem;
}

.order-items-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sa-text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding-left: 4px;
}

.order-items-info i {
    color: var(--sa-text-subtle);
}

.order-action {
    margin-top: 10px;
}

.btn-delivered {
    width: 100%;
    padding: 16px;
    background: var(--sa-success);
    color: white;
    border: none;
    border-radius: var(--sa-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: var(--sa-font);
    box-shadow: var(--sa-shadow-md);
}

.btn-delivered:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-delivered:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.delivery-status-badge.delivery-status-completed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    background: var(--sa-text-subtle);
    color: white;
    border: none;
    border-radius: var(--sa-radius);
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-delivered i {
    font-size: 1.2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--sa-surface);
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-shadow-md);
    margin-top: 20px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--sa-text-subtle);
    margin-bottom: 20px;
}

.empty-state h2 {
    font-family: var(--sa-font);
    font-weight: 700;
    color: var(--sa-text);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.empty-state p {
    color: var(--sa-text-muted);
    font-size: 1rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--sa-text-muted);
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

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

/* Success Animation */
.order-delivered {
    animation: slideOut 0.5s ease-out forwards;
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-100%);
        max-height: 0;
        margin: 0;
        padding: 0;
    }
}

/* PIN Code Modal */
.pin-code-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.pin-code-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.pin-code-modal-content {
    position: relative;
    background: var(--sa-surface);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--sa-shadow-md);
    z-index: 1;
}

.pin-code-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.pin-code-modal-header i {
    font-size: 3rem;
    color: var(--sa-primary);
    margin-bottom: 15px;
    display: block;
}

.pin-code-modal-header h2 {
    font-family: var(--sa-font);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--sa-text);
    margin: 0;
}

.pin-code-modal-body {
    text-align: center;
}

.pin-code-modal-body p {
    color: var(--sa-text-muted);
    margin-bottom: 25px;
    font-size: 1rem;
}

.pin-code-input-group {
    margin-bottom: 20px;
}

.pin-code-input {
    width: 100%;
    padding: 18px;
    font-size: 2rem;
    text-align: center;
    border: 3px solid var(--sa-border);
    border-radius: var(--sa-radius);
    font-family: var(--sa-font);
    font-weight: 700;
    letter-spacing: 8px;
    transition: all 0.3s ease;
    background: var(--sa-bg);
    color: var(--sa-text);
}

.pin-code-input:focus {
    outline: none;
    border-color: var(--sa-primary);
    background: var(--sa-surface);
    box-shadow: 0 0 0 4px rgba(221, 44, 93, 0.1);
}

.pin-code-error {
    color: var(--sa-danger);
    font-size: 0.9rem;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--sa-danger-soft);
    border-radius: var(--sa-radius-sm);
    border: 1px solid var(--sa-danger);
}

.pin-code-submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--sa-primary);
    color: white;
    border: none;
    border-radius: var(--sa-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: var(--sa-font);
    box-shadow: var(--sa-shadow-md);
}

.pin-code-submit-btn:active {
    transform: scale(0.98);
    background: var(--sa-primary-hover);
}

.pin-code-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pin-code-submit-btn i {
    font-size: 1.2rem;
}

/* Confirmation Modal */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.confirmation-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.confirmation-modal-content {
    position: relative;
    background: var(--sa-surface);
    border-radius: 16px;
    padding: 0;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--sa-shadow-md);
    z-index: 1;
    overflow: hidden;
}

.confirmation-modal-header {
    text-align: center;
    padding: 25px 25px 15px;
    background: var(--sa-primary);
    color: white;
}

.confirmation-modal-header i {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
    opacity: 0.9;
}

.confirmation-modal-header h2 {
    font-family: var(--sa-font);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.confirmation-modal-body {
    padding: 25px;
    text-align: center;
}

.confirmation-modal-body p {
    color: var(--sa-text);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

.confirmation-modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid var(--sa-border);
    background: var(--sa-bg);
}

.confirmation-btn-cancel,
.confirmation-btn-confirm {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--sa-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: var(--sa-font);
}

.confirmation-btn-cancel {
    background: var(--sa-text-subtle);
    color: white;
}

.confirmation-btn-cancel:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.confirmation-btn-confirm {
    background: var(--sa-success);
    color: white;
}

.confirmation-btn-confirm:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Responsive adjustments for very small screens */
@media (max-width: 360px) {
    .delivery-header h1 {
        font-size: 1.3rem;
    }
    
    .order-number {
        font-size: 1.5rem;
    }
    
    .address-street {
        font-size: 0.95rem;
    }
    
    .pin-code-modal-content {
        padding: 20px;
    }
    
    .pin-code-input {
        font-size: 1.5rem;
        padding: 15px;
    }
}

/* Connect page (slug+pin gateway) */
.delivery-connect-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--sa-bg);
}
.delivery-connect-card {
    background: var(--sa-surface);
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-shadow-md);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--sa-border);
}
.delivery-connect-card h1 {
    font-family: var(--sa-font);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sa-text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.delivery-connect-card h1 i { color: var(--sa-primary); }
.delivery-connect-description {
    color: var(--sa-text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}
.delivery-connect-error {
    color: var(--sa-danger);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.delivery-connect-form { margin-top: 1rem; }
.delivery-connect-field {
    margin-bottom: 1rem;
}
.delivery-connect-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--sa-text);
}
.delivery-connect-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius-sm);
    font-size: 1rem;
    font-family: var(--sa-font);
}
.delivery-connect-field input:focus {
    outline: none;
    border-color: var(--sa-primary);
    box-shadow: 0 0 0 3px rgba(221, 44, 93, 0.1);
}
.delivery-connect-submit {
    width: 100%;
    padding: 12px;
    background: var(--sa-primary);
    color: #fff;
    border: none;
    border-radius: var(--sa-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0.5rem;
    font-family: var(--sa-font);
}
.delivery-connect-submit:hover { background: var(--sa-primary-hover); }
