/* SnapQuote - Dark Theme Mobile-First Styles */

:root {
    --primary: #4ade80;
    --primary-dark: #22c55e;
    --primary-light: #86efac;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --success: #4ade80;
    --error: #ef4444;
    --warning: #f59e0b;
    --recording: #dc2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
}

#app {
    min-height: 100vh;
    position: relative;
}

/* Screen States */
.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* Logo & Branding */
.logo {
    text-align: center;
    margin-bottom: 4rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo h1::before {
    content: '⚡';
    font-size: 2.5rem;
    background: var(--primary);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.5rem;
}

.logo-small h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    border: none;
    border-radius: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    max-width: 400px;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 4px 16px rgba(74, 222, 128, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
    max-width: 140px;
}

.btn-secondary:active {
    background: var(--bg-input);
}

.btn-finish {
    margin-top: auto;
    background: var(--primary);
}

.status-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 1rem;
}

/* Icon Styles */
.icon {
    font-size: 1.5rem;
    line-height: 1;
}

/* Recording Screen */
#screen-recording {
    justify-content: flex-start;
    padding-top: 3rem;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    color: var(--recording);
    font-weight: 600;
    font-size: 1.125rem;
}

.pulse {
    width: 12px;
    height: 12px;
    background: var(--recording);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.2);
    }
}

.timer {
    font-size: 3rem;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 3rem;
    font-variant-numeric: tabular-nums;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 500px;
}

.photos {
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--bg-card);
    border: 2px solid var(--border);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item .delete-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}

.markers {
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
}

.marker {
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    border-left: 3px solid var(--primary);
}

.marker strong {
    color: var(--primary);
    margin-right: 0.5rem;
}

/* Form */
form {
    width: 100%;
    max-width: 500px;
}

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

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

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

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

/* Processing Screen */
.processing-animation,
.success-content,
.error-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

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

.processing-animation h2,
.success-content h2,
.error-content h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

#processing-status {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Success & Error States */
.success-icon,
.error-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1.5rem;
}

.success-icon {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.error-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

#success-message,
#error-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Quote Review Screen */
.quote-room-section {
    margin-bottom: 2rem;
}

.quote-room-header {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quote-room-header h3 {
    font-size: 1.125rem;
    color: var(--text);
    margin: 0;
}

.quote-room-subtotal {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
}

.quote-item {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.quote-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.quote-item-description {
    flex: 1;
    color: var(--text);
    font-size: 0.95rem;
}

.quote-item-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quote-item-price input {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
    text-align: right;
}

.quote-item-price input:focus {
    outline: none;
    border-color: var(--primary);
}

.quote-item-delete {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    opacity: 0.7;
}

.quote-item-delete:hover {
    opacity: 1;
}

.quote-item-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.5rem;
}

.quote-totals {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-top: 2rem;
    border: 2px solid var(--primary);
}

.quote-total-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.quote-total-line.grand-total {
    border-top: 2px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Responsive */
@media (max-width: 480px) {
    .screen {
        padding: 1.5rem 1rem;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .logo h1::before {
        width: 48px;
        height: 48px;
        font-size: 2rem;
    }

    .timer {
        font-size: 2.5rem;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }

    .quick-actions {
        flex-wrap: wrap;
    }

    .btn-secondary {
        flex: 1;
        min-width: 100px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

/* Prevent zoom on input focus (iOS) */
@media screen and (max-width: 480px) {
    input, select, textarea {
        font-size: 16px;
    }
}

/* History Screen Styles */
.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.15);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.history-item-header h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.history-address {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.history-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.history-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.history-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    background: rgba(74, 222, 128, 0.1);
    color: var(--primary);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

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

.btn-secondary-small {
    flex: 1;
    min-width: 90px;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

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

.btn-danger {
    color: var(--error) !important;
    border-color: var(--error) !important;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text);
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.modal-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.modal-content p {
    margin-bottom: 0.75rem;
}

@media (max-width: 640px) {
    .history-item-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .history-meta {
        align-items: flex-start;
    }

    .history-item-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .history-badges {
        width: 100%;
    }

    .btn-secondary-small {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

/* Admin Dashboard Styles */
#admin-users-table th {
    color: var(--text-secondary);
}

#admin-users-table td {
    color: var(--text);
}

#admin-users-table tr:hover {
    background: var(--bg-input);
}

@media (max-width: 768px) {
    #admin-stats {
        grid-template-columns: 1fr 1fr !important;
    }
    
    #screen-admin > div > div:nth-child(2) {
        grid-template-columns: 1fr !important;
    }
    
    #admin-users-table {
        font-size: 0.85rem;
    }
    
    #admin-users-table th,
    #admin-users-table td {
        padding: 0.5rem !important;
    }
}
