/* Ads Engine - Custom Styles */
/* Constraints: ALL rem (zero px), mobile-first, dark mode default, touch-friendly */

html {
    color-scheme: dark;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
}

/* Sidebar - mobile-first: hidden on small screens */
.sidebar {
    width: 15.625rem;
    min-height: 100vh;
    transition: transform 0.3s ease;
}

@media (max-width: 48rem) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 50;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    main {
        margin-left: 0 !important;
    }
}

.sidebar a {
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar a.active {
    background-color: rgba(99, 102, 241, 0.2);
    border-right: 0.1875rem solid #6366f1;
    color: #818cf8;
}

.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Cards */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0.5rem;
}

.stat-card:hover {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.3);
}

/* Tables */
.data-table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #9ca3af;
    padding: 0.75rem 1rem;
}

.data-table td {
    vertical-align: middle;
    padding: 0.75rem 1rem;
}

.data-table tr {
    transition: background-color 0.15s ease;
}

.data-table tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Buttons - touch-friendly min height 2.75rem */
.btn-primary,
.btn-secondary,
.btn-danger {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-weight: 500;
    border-radius: 0.375rem;
    padding: 0.625rem 1.25rem;
}

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

.btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-0.0625rem);
}

.btn-secondary {
    background-color: #374151;
    color: #d1d5db;
}

.btn-secondary:hover {
    background-color: #4b5563;
    transform: translateY(-0.0625rem);
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
    transform: translateY(-0.0625rem);
}

.btn-sm {
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Form inputs - touch-friendly */
.form-input {
    background-color: #374151;
    border: 0.0625rem solid #4b5563;
    color: white;
    border-radius: 0.375rem;
    padding: 0.625rem 0.75rem;
    min-height: 2.75rem;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 0.125rem rgba(99, 102, 241, 0.3);
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
}

.form-select {
    background-color: #374151;
    border: 0.0625rem solid #4b5563;
    color: white;
    border-radius: 0.375rem;
    padding: 0.625rem 0.75rem;
    min-height: 2.75rem;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #6366f1;
}

/* Loading spinner */
.spinner {
    border: 0.1875rem solid #374151;
    border-top: 0.1875rem solid #6366f1;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background-color: #1f2937;
    border-radius: 0.75rem;
    max-height: 85vh;
    width: 90%;
    max-width: 32rem;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 0.0625rem solid #374151;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 0.0625rem solid #374151;
    flex-shrink: 0;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast notifications */
.toast {
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Badge animations */
.badge {
    transition: transform 0.15s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Card grid - responsive */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 40rem) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 64rem) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 80rem) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Stat grid - responsive */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 30rem) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 64rem) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile menu toggle */
.mobile-menu-btn {
    display: none;
    min-height: 2.75rem;
    min-width: 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background: #374151;
    color: white;
    cursor: pointer;
    border: none;
}

@media (max-width: 48rem) {
    .mobile-menu-btn {
        display: flex;
    }
}

/* Step indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.step-dot.active {
    background-color: #6366f1;
    color: white;
}

.step-dot.completed {
    background-color: #22c55e;
    color: white;
}

.step-dot.inactive {
    background-color: #374151;
    color: #9ca3af;
}

.step-line {
    width: 3rem;
    height: 0.125rem;
    background-color: #374151;
    align-self: center;
    transition: background-color 0.3s ease;
}

.step-line.completed {
    background-color: #22c55e;
}

/* Tab buttons */
.tab-btn {
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-bottom: 0.125rem solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tab-btn:hover {
    color: #d1d5db;
}

.tab-btn.active {
    color: #818cf8;
    border-bottom-color: #6366f1;
}

/* Scrollbar styling for dark mode */
::-webkit-scrollbar {
    width: 0.5rem;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}
