/**
 * know.contact Styles
 * Mobile-first responsive design inspired by CallWindow
 */

:root {
    --primary: #2C5AA0;
    --primary-hover: #1e3f73;
    --secondary: #e0e7ef;
    --background: #f4f6fa;
    --card: #fff;
    --text: #21243d;
    --text-light: #6c757d;
    --border: #b6bdd5;
    --success: #28a745;
    --danger: #dc3545;
    --radius: 12px;
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

html, body {
    height: 100%;
    margin: 0;
    background: var(--background);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    color: var(--text);
    line-height: 1.6;
}

body {
    display: flex;
    min-height: 100vh;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2vh;
}

.container {
    background: var(--card);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 1.5em;
    margin: 0 1em;
    width: 100%;
    max-width: 500px;
    position: relative;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1em;
}

.header h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.2em;
    font-weight: 700;
}

.tagline {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

/* Stats Bar */
.stats-bar {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1.5em;
    padding: 0.5em;
    background: var(--secondary);
    border-radius: 8px;
}

.stats-bar .separator {
    margin: 0 0.5em;
}

/* Search Section */
.search-section {
    margin-bottom: 1.5em;
}

#phoneSearch {
    width: 100%;
    padding: 0.9em;
    font-size: 1.2em;
    border-radius: 10px;
    border: 2px solid var(--border);
    outline: none;
    transition: border 0.2s, background 0.2s;
    font-family: inherit;
}

#phoneSearch:focus {
    border-color: var(--primary);
    background: #f6faff;
}

/* Settings Button */
.settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: background 0.2s, transform 0.1s;
    z-index: 100;
}

.settings-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.settings-btn:active {
    transform: scale(0.95);
}

/* Settings Menu Popup */
.settings-menu {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 99;
    min-width: 220px;
    overflow: hidden;
}

.settings-menu.show {
    display: block;
    animation: slideUp 0.2s ease-out;
}

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

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.8em;
    width: 100%;
    padding: 1em 1.2em;
    background: none;
    border: none;
    border-bottom: 1px solid var(--secondary);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    font-family: inherit;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--secondary);
}

.menu-item:active {
    background: #d0d7df;
}

.menu-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Result Cards */
#searchResults {
    margin-top: 1em;
}

.result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1em;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.result-card:hover {
    box-shadow: var(--shadow);
}

.result-collapsed {
    padding: 1.2em;
    cursor: pointer;
    position: relative;
}

.result-collapsed:hover {
    background: #f8f9fa;
}

.result-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.3em;
}

.result-location {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.5em;
}

.result-phone {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.3em;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.result-last-interaction {
    font-size: 0.9rem;
    color: var(--text-light);
}

.expand-arrow {
    position: absolute;
    right: 1.2em;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.2rem;
}

/* Expanded View */
.result-expanded {
    padding: 1.2em;
}

.result-section {
    margin-bottom: 1em;
    padding-bottom: 0.8em;
    border-bottom: 1px solid var(--secondary);
}

.result-section:last-of-type {
    border-bottom: none;
}

.result-section strong {
    display: block;
    margin-bottom: 0.3em;
    color: var(--primary);
}

.phone-list {
    list-style: none;
    padding: 0;
    margin-top: 0.5em;
}

.phone-list li {
    padding: 0.4em 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.result-actions {
    display: flex;
    gap: 0.8em;
    margin-top: 1em;
    flex-wrap: wrap;
}

.collapse-arrow {
    text-align: center;
    padding: 0.8em;
    color: var(--primary);
    cursor: pointer;
    margin-top: 1em;
    border-top: 1px solid var(--secondary);
    font-size: 0.9rem;
}

.collapse-arrow:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-link, .btn-danger {
    padding: 0.7em 1.2em;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

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

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

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover {
    background: #d0d7df;
}

.btn-link {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

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

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

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

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

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.2em;
}

/* Data Summary */
.data-summary {
    background: var(--secondary);
    border-radius: 8px;
    padding: 1em;
    margin-bottom: 1.5em;
}

.data-summary h3 {
    color: var(--primary);
    font-size: 1rem;
    margin: 0 0 0.8em 0;
    font-weight: 600;
}

.summary-stats {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: var(--text);
    font-size: 0.9rem;
}

.stat-value {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
}

/* Import Form */
.import-section {
    margin-bottom: 1.5em;
}

.import-section label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 500;
    color: var(--text);
}

.import-section select,
.import-section input[type="file"],
.import-section textarea {
    width: 100%;
    padding: 0.7em;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: inherit;
}

.import-section select:focus,
.import-section textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.import-section textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
}

.import-actions {
    display: flex;
    gap: 1em;
    margin-top: 1em;
}

.import-preview {
    margin-top: 1em;
    padding: 1em;
    background: var(--secondary);
    border-radius: 8px;
}

.success-message {
    color: var(--success);
    font-weight: 500;
}

/* Interaction Cards */
.interaction-card {
    background: var(--secondary);
    border-radius: 8px;
    padding: 1em;
    margin-bottom: 1em;
}

.interaction-card:last-child {
    margin-bottom: 0;
}

.interaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8em;
    padding-bottom: 0.8em;
    border-bottom: 1px solid #d0d7df;
}

.disposition-badge {
    background: var(--primary);
    color: white;
    padding: 0.3em 0.7em;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.interaction-row {
    margin-bottom: 0.5em;
    font-size: 0.95rem;
}

.interaction-row strong {
    color: var(--primary);
}

/* Utility Classes */
.no-results, .no-data, .loading {
    text-align: center;
    padding: 2em;
    color: var(--text-light);
    font-size: 1.1rem;
}

.result-count {
    text-align: center;
    padding: 1.5em 1em;
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    body {
        padding-top: 1vh;
    }

    .container {
        padding: 1em;
        margin: 0.5em;
        max-width: 100%;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .result-name {
        font-size: 1.2rem;
    }

    #phoneSearch {
        font-size: 1.1em;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary, .btn-link {
        width: 100%;
        text-align: center;
    }

    .settings-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .import-actions {
        flex-direction: column;
    }
}

@media (min-width: 601px) {
    .container {
        padding: 2em 2.5em;
    }
}
