/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--gray-50);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.top-bar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.top-bar nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.top-bar nav a {
    color: var(--gray-700);
    text-decoration: none;
}

.top-bar nav a:hover {
    color: var(--primary);
}

.logout-form {
    display: inline;
}

.logout-form button {
    background: none;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    font-size: 1rem;
}

.logout-form button:hover {
    color: var(--primary);
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-500);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-google {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 0.75rem 1.5rem;
    width: 100%;
    justify-content: center;
}

.btn-google:hover {
    background: var(--gray-50);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--gray-900);
}

.tagline {
    font-size: 1.25rem;
    color: var(--gray-500);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* How It Works */
.how-it-works {
    padding: 4rem 1rem;
    background: white;
}

.how-it-works h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    text-align: center;
}

.step-number {
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step h3 {
    margin-bottom: 0.5rem;
}

.step p {
    color: var(--gray-500);
}

/* Features */
.features {
    padding: 4rem 1rem;
}

.features h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.feature {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
}

.feature h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--gray-500);
    margin: 0;
}

/* Call Info */
.call-info {
    padding: 4rem 1rem;
    background: var(--primary);
    color: white;
    text-align: center;
}

.call-info h2 {
    margin-bottom: 2rem;
}

.phone-display {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.phone-number {
    font-weight: 700;
    font-size: 2rem;
}

.plus {
    margin: 0 0.5rem;
}

.box-label {
    opacity: 0.9;
}

/* Login Page */
.login-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-box h1 {
    margin-top: 0;
}

.terms {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.terms a {
    color: var(--primary);
}

.setup-notice {
    text-align: left;
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.setup-notice h2 {
    margin-top: 0;
    font-size: 1.25rem;
    color: var(--gray-900);
}

.setup-notice pre {
    background: var(--gray-200);
    padding: 0.75rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    font-size: 0.8rem;
}

.setup-notice code {
    font-family: monospace;
}

.error-banner {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Dashboard */
.dashboard {
    padding: 2rem 0;
}

.box-info {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.box-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.25rem;
}

.share-text {
    color: var(--gray-500);
}

.btn-copy {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Voicemail List */
.voicemail-list {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.voicemail-list h2 {
    margin-top: 0;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.load-more-section {
    text-align: center;
    padding: 2rem 0 1rem;
}

.load-more-section .btn {
    min-width: 200px;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message {
    border-bottom: 1px solid var(--gray-100);
}

.message:last-child {
    border-bottom: none;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.message-header:hover {
    background: var(--gray-50);
}

.message-indicator {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.new .message-indicator {
    color: var(--primary);
}

.message.listened .message-indicator {
    color: var(--gray-300);
}

.message-summary {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
}

.caller {
    font-weight: 500;
}

.date, .duration {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.message-expand {
    color: var(--gray-400);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.message.expanded .message-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

/* Drawer - Three Panel Layout */
.message-drawer {
    background: var(--gray-50);
    padding: 1rem;
}

.drawer-panels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.drawer-panel {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.drawer-player audio {
    width: 100%;
}

.pending-message {
    color: var(--gray-500);
    font-style: italic;
    font-size: 0.875rem;
}

.transcription-text {
    color: var(--gray-700);
    font-style: italic;
    line-height: 1.5;
    font-size: 0.9rem;
}

.no-transcription {
    color: var(--gray-400);
    font-style: italic;
    font-size: 0.875rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--gray-500);
    font-size: 0.8rem;
}

.detail-value {
    font-weight: 500;
    font-size: 0.85rem;
    text-align: right;
}

.drawer-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-square {
    border-radius: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
}

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

.modal-dialog {
    background: white;
    border-radius: 0.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-body {
    padding: 1.25rem;
    color: var(--gray-700);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
}

/* Responsive: stack panels on smaller screens */
@media (max-width: 900px) {
    .drawer-panels {
        grid-template-columns: 1fr;
    }
}

/* Legacy styles kept for compatibility */
.message-details {
    flex: 1;
}

.message-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.transcription {
    color: var(--gray-500);
    font-size: 0.875rem;
    font-style: italic;
}

.btn-play {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.btn-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    opacity: 0.5;
}

.btn-delete:hover {
    opacity: 1;
}

.message.playing {
    background: var(--gray-50);
    border-left: 3px solid var(--primary);
    margin-left: -3px;
}

.processing {
    color: var(--gray-500);
    font-size: 0.75rem;
    font-style: italic;
}

.copied-notice {
    color: var(--success);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Audio Player */
.audio-player {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--primary);
}

.player-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.player-info .caller {
    font-weight: 600;
}

.player-info .date {
    color: var(--gray-500);
}

.audio-player audio {
    width: 100%;
    margin-bottom: 1rem;
}

.player-transcription {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.player-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Settings */
.settings {
    padding: 2rem 0;
    max-width: 600px;
    margin: 0 auto;
}

.settings h1 {
    margin-bottom: 2rem;
}

.settings-section {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.char-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: right;
    display: block;
}

.help-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.success-message {
    margin-top: 1rem;
    padding: 0.5rem;
    background: #dcfce7;
    color: var(--success);
    border-radius: 0.25rem;
    text-align: center;
}

.danger-zone {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.danger-zone h3 {
    color: var(--danger);
}

.delete-confirmation {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
}

.delete-confirmation p {
    margin: 0 0 1rem 0;
}

.delete-confirmation .error-message {
    color: var(--danger);
    padding: 0;
    text-align: left;
    margin-bottom: 1rem;
}

/* Error message */
.error-message {
    text-align: center;
    padding: 4rem 2rem;
}

.error-message h1 {
    color: var(--danger);
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.form-group input[type="password"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    font-size: 1rem;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 2rem;
    }

    .box-number {
        font-size: 2rem;
    }

    .message {
        flex-wrap: wrap;
    }

    .message-actions {
        width: 100%;
        margin-top: 0.5rem;
    }
}
