/* Reset and base styles */
.address-option.invalid {
    opacity: 0.6;
    cursor: not-allowed;
}

.address-option.invalid input[type="radio"] {
    cursor: not-allowed;
}

.warning-icon {
    display: inline-block;
    font-size: 0.875rem;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

/* Login page styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo h1 {
    font-size: 2rem;
    color: #4f46e5;
    margin-bottom: 0.5rem;
}

.logo p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Filter styles */
.filters-container {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    font-size: 0.875rem;
    min-width: 120px;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

/* Address warning styles */
.address-warning {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.address-warning:hover {
    color: #dc2626 !important;
}

/* Custom tooltip styles */
.address-warning[data-tooltip] {
    position: relative;
}

.address-warning[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.address-warning[data-tooltip]:after {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.address-warning[data-tooltip]:hover:before,
.address-warning[data-tooltip]:hover:after,
.address-warning[data-tooltip].show-tooltip:before,
.address-warning[data-tooltip].show-tooltip:after {
    opacity: 1;
    visibility: visible;
}

.login-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-input, input[type="email"], input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus, input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.demo-credentials {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.875rem;
    color: #0369a1;
}

/* Dashboard styles */
.navbar {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.nav-brand h2 {
    color: #4f46e5;
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease-in-out;
}

.nav-link:hover, .nav-link.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user span {
    font-weight: 500;
    color: #374151;
}

.main-content {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: #111827;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    font-size: 0.875rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: bold;
    color: #4f46e5;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #6b7280;
    font-size: 0.875rem;
}

.events-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.events-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.events-header h2 {
    color: #111827;
}

.search-box {
    width: 300px;
}

.events-table {
    width: 100%;
    border-collapse: collapse;
}

.events-table th {
    background-color: #f9fafb;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.events-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.events-table tr:hover {
    background-color: #f9fafb;
}

.event-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.event-type.birthday {
    background-color: #fef3c7;
    color: #92400e;
}

.event-type.spouse_birthday {
    background-color: #e0e7ff;
    color: #3730a3;
}

.event-type.child_birthday {
    background-color: #fce7f3;
    color: #be185d;
}

.event-type.home_anniversary {
    background-color: #d1fae5;
    color: #065f46;
}

.status-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pill.scheduled { background-color: #dbeafe; color: #1e40af; }
.status-pill.printing { background-color: #fef3c7; color: #92400e; }
.status-pill.dispatched { background-color: #e0e7ff; color: #3730a3; }
.status-pill.delivered { background-color: #d1fae5; color: #065f46; }
.status-pill.returned { background-color: #fee2e2; color: #dc2626; }
.status-pill.cancelled { background-color: #f3f4f6; color: #6b7280; }
.status-pill.error { background-color: #fecaca; color: #991b1b; }
.status-pill.skipped { background-color: #6b7280; color: white; }

/* Approval action buttons */
.approval-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-approve, .btn-skip, .btn-change-decision {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-approve {
    background-color: #10b981;
    color: white;
}

.btn-approve:hover {
    background-color: #059669;
}

.btn-skip {
    background-color: #6b7280;
    color: white;
}

.btn-skip:hover {
    background-color: #4b5563;
}

.btn-change-decision {
    background-color: #3b82f6;
    color: white;
    font-size: 0.6rem;
    padding: 0.2rem 0.5rem;
}

.btn-change-decision:hover {
    background-color: #2563eb;
}

.approval-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #4f46e5;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.address-dropdown {
    position: relative;
    display: inline-block;
}

.address-btn {
    background: none;
    border: none;
    color: #4f46e5;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
}

.sync-status {
    font-size: 0.75rem;
    color: #6b7280;
}

.sync-status.stale {
    color: #dc2626;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.no-events {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.address-option {
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.address-option:hover {
    border-color: #4f46e5;
    background-color: #f8fafc;
}

.address-option.selected {
    border-color: #4f46e5;
    background-color: #eff6ff;
}

.address-option input[type="radio"] {
    margin-right: 0.75rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-menu {
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-controls {
        width: 100%;
        justify-content: space-between;
    }

    .events-table {
        font-size: 0.875rem;
    }

    .events-table th,
    .events-table td {
        padding: 0.75rem 0.5rem;
    }

    .search-box {
        width: 100%;
    }
}

/* Bulk selection styles */
.event-checkbox {
    margin: 0;
    cursor: pointer;
}

.event-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#header-checkbox {
    cursor: pointer;
}

.bulk-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
