/* Dashboard Styles */

/* Auth Screen */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.auth-container {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
}

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

.auth-brand .logo {
    font-size: 3rem;
}

.auth-brand h2 {
    margin-top: 0.5rem;
    color: var(--text);
}

.auth-form h3 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
}

.h-captcha {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
}

/* Dashboard Layout */
.dashboard-nav {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.nav-user #logout-btn {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.nav-user #logout-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.dashboard-container {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    transition: width 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--border);
}

.sidebar.collapsed .sidebar-toggle {
    right: 50%;
    transform: translateX(50%);
}

.sidebar-menu {
    list-style: none;
    margin-top: 3rem;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-menu a .icon {
    font-size: 1.3rem;
    min-width: 1.3rem;
    display: inline-block;
}

.sidebar-menu a .text {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-menu a {
    padding: 0.75rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu a .text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-menu a:hover {
    background: var(--bg);
    text-decoration: none;
}

.sidebar-menu .active a {
    background: var(--primary);
    color: white;
}

.dashboard-main {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.dashboard-view h1 {
    margin-bottom: 2rem;
}

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

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.stat-success {
    border-left-color: var(--success);
}

.stat-card.stat-warning {
    border-left-color: var(--warning);
}

.stat-icon {
    font-size: 3rem;
    line-height: 1;
    opacity: 0.8;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-change {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.charts-grid canvas {
    max-height: 300px;
}

/* Card */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card h2 {
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-light);
}

/* Accounts Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.account-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: transform 0.2s;
}

.account-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.account-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.account-status {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.account-status.active {
    background: #d1fae5;
    color: var(--success);
}

.account-status.inactive {
    background: #fee2e2;
    color: var(--danger);
}

.account-id {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.account-actions {
    display: flex;
    gap: 0.5rem;
}

/* Unified button styling for account actions */
.account-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: white;
}

.account-actions .btn-primary {
    background: #667eea;
}

.account-actions .btn-primary:hover {
    background: #5a67d8;
    transform: none;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.account-actions .btn-secondary {
    background: #6b7280;
}

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

.account-actions .btn-danger {
    background: #ef4444;
}

.account-actions .btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

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

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

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.modal-content form {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Analysis List */
.analysis-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.analysis-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: var(--success);
}

.badge-warning {
    background: #fef3c7;
    color: var(--warning);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

/* Optimization List */
.optimization-item {
    background: var(--bg);
    border-left: 4px solid var(--success);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.optimization-item:hover {
    transform: translateX(4px);
}

.optimization-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.optimization-number {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.optimization-type {
    background: var(--bg-alt);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.optimization-savings {
    margin-left: auto;
    color: var(--success);
    font-weight: 600;
}

.optimization-details {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

.account-regions, .account-scanned {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #4CAF50;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.info {
    border-left-color: #2196F3;
}

.toast.warning {
    border-left-color: #ff9800;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.toast-message {
    font-size: 14px;
    color: #666;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #333;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease-in forwards;
}

/* Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Confirmation Modal */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.confirm-modal.show {
    display: flex;
}

.confirm-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.confirm-icon {
    font-size: 32px;
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.confirm-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-buttons button {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-cancel {
    background: #f0f0f0;
    color: #333;
}

.confirm-cancel:hover {
    background: #e0e0e0;
}

.confirm-confirm {
    background: #f44336;
    color: white;
}

.confirm-confirm:hover {
    background: #d32f2f;
}

/* Autopilot / Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}

.badge-success {
    background: #10b981;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-danger {
    background: #ef4444;
    color: white;
}

.badge-info {
    background: #3b82f6;
    color: white;
}

.badge-primary {
    background: #6366f1;
    color: white;
}

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

.badge-dark {
    background: #374151;
    color: white;
}

/* Small buttons for actions */
.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: #3b82f6;
    color: white;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-success.btn-sm {
    background: #10b981;
}

.btn-success.btn-sm:hover {
    background: #059669;
}

.btn-danger.btn-sm {
    background: #ef4444;
}

.btn-danger.btn-sm:hover {
    background: #dc2626;
}

.btn-warning.btn-sm {
    background: #f59e0b;
}

.btn-warning.btn-sm:hover {
    background: #d97706;
}

/* Job table improvements */
#autopilot-jobs-table code {
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #374151;
}

/* Modal styles */
.modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: modalFadeIn 0.3s;
}

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

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

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

.close-modal {
    font-size: 2rem;
    line-height: 1;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

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

/* Disabled button state - use !important to override all other styles */
button:disabled,
button.btn-disabled,
.btn-disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background-color: #9ca3af !important;
    border-color: #9ca3af !important;
}

button:disabled:hover,
button.btn-disabled:hover,
.btn-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
    background-color: #9ca3af !important;
}

/* Enabled button state - ensure it overrides disabled styles */
button:not(:disabled):not(.btn-disabled) {
    opacity: 1 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Filter form improvements */
.form-group select {
    width: 100%;
}

/* Table cell alignment */
.data-table td {
    vertical-align: middle;
}

.data-table td button {
    margin-right: 0.25rem;
}

/* Success button */
.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* Danger button */
.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Responsive table for small screens */
@media (max-width: 768px) {
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th, .data-table td {
        padding: 0.5rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Tab navigation */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: #3b82f6;
    background: #f3f4f6;
}

.tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: #eff6ff;
}

.tab-content {
    display: none;
}

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

@media (max-width: 768px) {
    .tab-nav {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Badge error (alias for danger) */
.badge-error {
    background: #ef4444;
    color: white;
}

/* Schedule Cards */
.schedule-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.schedule-header h4 {
    margin: 0;
    color: #111827;
}

.schedule-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.schedule-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.95rem;
    color: #111827;
}

.schedule-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.schedule-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: white;
}

.schedule-actions .btn-primary {
    background: #667eea;
}

.schedule-actions .btn-primary:hover {
    background: #5a67d8;
}

.schedule-actions .btn-secondary {
    background: #6b7280;
}

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

.schedule-actions .btn-danger {
    background: #ef4444;
}

.schedule-actions .btn-danger:hover {
    background: #dc2626;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Help Section in Sidebar */
.sidebar a[href^="mailto"]:hover,
.sidebar a[href^="https:"]:hover {
    background: #f3f4f6;
}

/* Dashboard Footer */
.dashboard-main > div[style*="border-top"] a:hover {
    text-decoration: underline;
}
