/* assets/css/addresses.css */

/* --- Theme Variable Dependencies (Assumed from your original CSS) ---
Ensure these variables are defined in your main theme.css or a variables file:
--theme-medium-gray, --theme-dark-gray, --theme-white, --theme-light-gray,
--theme-dark-yellow, --theme-dark-yellow-hover, --theme-dark-yellow-rgb,
--theme-text-muted, --theme-primary (if used for buttons)
---------------------------------------------------------------------- */

/* --- General Page Structure & Typography --- */
.addresses-page {
    font-size: 0.95rem; /* Base font size for the page */
}

.addresses-page .page-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem; /* Increased bottom margin for separation */
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--theme-medium-gray);
}

.addresses-page .page-header-actions h1 {
    font-size: 1.75rem; /* Slightly reduced for a cleaner look */
    font-weight: 600;
    color: var(--theme-dark-gray);
    margin-bottom: 0;
}

.addresses-page .page-header-actions .btn {
    font-size: 0.9rem; /* Consistent button font size */
}
.addresses-page .page-header-actions .btn i {
    margin-right: 0.5rem; /* Space between icon and text */
}


/* --- Alerts --- */
.addresses-page .alert {
    padding: 0.85rem 1.25rem; /* Adjusted padding */
    display: flex;
    align-items: center;
    font-size: 0.9rem; /* Text size within alerts */
    margin-bottom: 1.5rem; /* Consistent margin */
}
.addresses-page .alert i {
    font-size: 1.1rem; /* Icon size in alerts */
    margin-right: 0.75rem; /* Space after icon */
}
/* Retaining your specific alert background/color styles */
.addresses-page .alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}
.addresses-page .alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}


/* --- Empty State --- */
.addresses-page .empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem; /* Generous padding */
    background: var(--theme-white, #fff); /* Fallback if var not defined */
    border: 1px dashed var(--theme-medium-gray, #ddd);
    border-radius: 10px; /* Consistent border-radius */
    margin-top: 2rem; /* Spacing from elements above */
}
.addresses-page .empty-state .empty-state-icon {
    font-size: 3rem;
    color: var(--theme-dark-yellow, #ffc107);
    margin-bottom: 1rem;
}
.addresses-page .empty-state .empty-state-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--theme-dark-gray, #333);
    margin-bottom: 0.75rem;
}
.addresses-page .empty-state .empty-state-text {
    color: var(--theme-text-muted, #6c757d);
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
}
.addresses-page .empty-state .btn {
    font-size: 1rem; /* Make primary action button slightly larger */
}
.addresses-page .empty-state .btn i {
    margin-right: 0.5rem;
}

/* --- Table Container & Table --- */
.addresses-page .table-container {
    background: var(--theme-white, #fff);
    border: 1px solid var(--theme-medium-gray, #ddd);
    border-radius: 10px;
    overflow: hidden; /* Important for border-radius on table */
    box-shadow: 0 1px 5px rgba(0,0,0,0.04);
    margin-top: 2rem; /* Spacing */
}

.addresses-page .table {
    margin-bottom: 0; /* Remove default table margin if inside a container */
}

.addresses-page .table th,
.addresses-page .table td {
    vertical-align: middle;
    padding: 0.85rem 1rem; /* Consistent cell padding */
    font-size: 0.9rem;
    word-break: break-word; /* Help prevent layout breaking from long text */
    overflow-wrap: break-word; /* Modern equivalent for word-break */
}

.addresses-page .table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--theme-text-muted, #6c757d);
    text-transform: uppercase; /* Optional: for a more standard table header look */
    background-color: var(--theme-light-gray, #f8f9fa); /* Light background for header */
}

.addresses-page .table-light-custom-highlight td {
    background-color: #fffcf0 !important; /* Ensure override if needed, light yellow */
    font-weight: 500;
}

/* Action Buttons in Table */
.addresses-page .table td .btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}
.addresses-page .table td .btn i.fa-fw { /* Ensure fixed-width icons align well */
    margin-right: 0.25rem;
}

/* Grouping for action buttons if not using a wrapper div */
.addresses-page .table td .btn-edit-address + .btn-delete-address {
    margin-left: 0.35rem; /* Space between edit and delete buttons */
}


.addresses-page .table .btn-set-default {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    color: var(--theme-text-muted, #6c757d);
    border-color: var(--theme-medium-gray, #ced4da);
}
.addresses-page .table .btn-set-default:hover {
    color: var(--theme-dark-gray, #343a40);
    background-color: var(--theme-light-gray, #e9ecef);
    border-color: var(--theme-dark-gray, #343a40);
}

/* Status Badge for "Default" */
.addresses-page .status-badge.status-delivered {
    background-color: var(--theme-dark-yellow, #ffc107);
    color: var(--theme-white, #fff); /* Ensure contrast */
    border: 1px solid var(--theme-dark-yellow-hover, #e0a800); /* Subtle border */
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem; /* Slightly larger for readability */
    font-weight: 500;
    border-radius: 0.25rem; /* Standard badge radius */
}
.addresses-page .status-badge.status-delivered i {
    margin-right: 0.3rem;
    font-size: 0.7rem; /* Match text size */
}

/* --- Modal Styling --- */
#addressModal .modal-content {
    border-radius: 10px;
    border: 1px solid var(--theme-medium-gray, #dee2e6);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15); /* Softer shadow for modal */
}
#addressModal .modal-header {
    background-color: var(--theme-light-gray, #f8f9fa);
    border-bottom: 1px solid var(--theme-medium-gray, #dee2e6);
    padding: 1rem 1.5rem;
}
#addressModal .modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--theme-dark-gray, #343a40);
}
#addressModal .modal-body {
    padding: 1.5rem; /* Main content padding */
}
#addressModal .modal-body .mb-3:last-child {
    margin-bottom: 0 !important; /* Remove margin from last form group in modal body if not needed */
}

#addressModal .modal-footer {
    border-top: 1px solid var(--theme-medium-gray, #dee2e6);
    padding: 1rem 1.5rem;
    background-color: var(--theme-light-gray, #f8f9fa);
    display: flex; /* Better control over button alignment */
    justify-content: flex-end; /* Align buttons to the right */
}
#addressModal .modal-footer .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem; /* Slightly more padding for footer buttons */
}
#addressModal .modal-footer .btn + .btn {
    margin-left: 0.5rem; /* Space between footer buttons */
}


/* Form elements inside modal */
#addressModal .form-label {
    font-weight: 500;
    color: var(--theme-dark-gray, #495057);
    margin-bottom: 0.4rem; /* Increased space below label */
    font-size: 0.88rem;
}
#addressModal .form-control,
#addressModal .form-check-input { /* Note: form-check-input styling is limited */
    border-radius: 6px;
    border: 1px solid var(--theme-medium-gray, #ced4da);
    font-size: 0.9rem;
    padding: 0.55rem 0.85rem; /* Adjusted padding for inputs */
}
#addressModal .form-control:focus {
    border-color: var(--theme-dark-yellow, #ffc107); /* Use theme variable for focus */
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-dark-yellow-rgb, 255,193,7), 0.25); /* Use theme variable */
}
#addressModal .form-check-input {
    margin-top: 0.2rem; /* Align checkbox better with label */
}
#addressModal .form-check-input:checked {
    background-color: var(--theme-dark-yellow, #ffc107);
    border-color: var(--theme-dark-yellow, #ffc107);
}
#addressModal .form-check-label {
    font-size: 0.9rem;
    color: var(--theme-text-muted, #6c757d);
    padding-left: 0.35rem;
}
#addressModal .form-text.text-muted { /* Helper text below inputs */
    font-size: 0.8rem;
    margin-top: 0.2rem; /* Space above helper text */
}


.location-permission-notice {
    font-size: 0.85rem;
    border-left: 4px solid var(--theme-dark-yellow, #ffc107);
    background-color: #fff9e8;
    color: #664d03;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem; /* Space below notice */
    display: flex;
    align-items: center;
}
.location-permission-notice i {
    color: var(--theme-dark-yellow, #ffc107);
    margin-right: 0.6rem;
}

.map-container-modal {
    height: 250px;
    border: 1px solid var(--theme-medium-gray, #ced4da);
    border-radius: 6px;
    margin-bottom: 0.75rem; /* Space below map */
    background-color: #e9ecef; /* Placeholder color while map loads */
}
#useCurrentLocationBtn { /* Specific button for current location */
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    width: 100%; /* Make it full width for easier tapping */
}
#useCurrentLocationBtn i {
    margin-right: 0.4rem;
}


/* Ensure modal buttons use theme button styling if Bootstrap defaults are overridden */
#addressModal .modal-footer .btn-primary {
    /* Assumes .btn-primary is styled by theme.css or Bootstrap */
    /* Example:
    background-color: var(--theme-primary, #007bff);
    border-color: var(--theme-primary, #007bff);
    color: #fff; */
}
#addressModal .modal-footer .btn-outline-secondary {
    border-color: var(--theme-medium-gray, #6c757d);
    color: var(--theme-text-muted, #6c757d);
}
#addressModal .modal-footer .btn-outline-secondary:hover {
    background-color: var(--theme-light-gray, #f8f9fa);
    color: var(--theme-dark-gray, #343a40);
}


/* Responsive adjustments for addresses page */
@media (max-width: 768px) {
    .addresses-page .page-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .addresses-page .page-header-actions h1 {
        text-align: center;
        font-size: 1.6rem;
    }
    .addresses-page .page-header-actions .btn {
        width: 100%;
        font-size: 0.95rem; /* Slightly larger for easier tap on mobile */
    }

    .addresses-page .table-container {
        /* Bootstrap .table-responsive class on the div wrapping the table in PHP is recommended */
        /* overflow-x: auto; /* Handled by .table-responsive generally */
    }
    .addresses-page .table th,
    .addresses-page .table td {
        padding: 0.75rem; /* Slightly adjust padding for mobile table cells */
        font-size: 0.85rem;
    }
    .addresses-page .table th {
        font-size: 0.78rem;
    }
    .addresses-page .table td.text-center { /* Actions column */
        min-width: 110px; /* Ensure enough space for buttons */
    }
    .addresses-page .table td .btn { /* Buttons in table on mobile */
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Modal on small screens */
    #addressModal .modal-dialog {
        margin: 0.5rem; /* Reduce outer margins */
    }
    #addressModal .modal-body {
        padding: 1.25rem; /* Reduce body padding */
    }
    #addressModal .modal-title {
        font-size: 1.1rem;
    }
    #addressModal .form-label {
        font-size: 0.85rem;
    }
    #addressModal .form-control,
    #addressModal .form-check-input {
        font-size: 0.9rem; /* Keep inputs readable */
    }
    .map-container-modal {
        height: 200px;
    }
    #addressModal .modal-footer {
        padding: 0.75rem 1rem;
    }
    #addressModal .modal-footer .btn {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }
}