/* ============================================================
   Conversor de Coordenadas — Design System
   ============================================================ */

:root {
    --color-bg: #0f1729;
    --color-bg-gradient: linear-gradient(145deg, #0f1729 0%, #1a2744 50%, #0d2137 100%);
    --color-surface: rgba(255, 255, 255, 0.04);
    --color-surface-hover: rgba(255, 255, 255, 0.07);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-focus: rgba(99, 155, 255, 0.5);
    --color-text: #e2e8f0;
    --color-text-muted: #8899b4;
    --color-text-dim: #556a8a;
    --color-primary: #4f8ffa;
    --color-primary-hover: #6ba3ff;
    --color-primary-glow: rgba(79, 143, 250, 0.25);
    --color-success: #34d399;
    --color-success-glow: rgba(52, 211, 153, 0.2);
    --color-accent: #a78bfa;
    --color-table-header: rgba(79, 143, 250, 0.08);
    --color-table-row-even: rgba(255, 255, 255, 0.02);
    --color-table-row-hover: rgba(79, 143, 250, 0.06);
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 30px rgba(79, 143, 250, 0.08);
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ============================================================
   Base & Reset
   ============================================================ */

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

body {
    font-family: var(--font-body);
    background: var(--color-bg-gradient);
    color: var(--color-text);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 32px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Container
   ============================================================ */

.container {
    width: 100%;
    max-width: 1160px;
    animation: fadeSlideIn 0.5s ease-out;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   Header
   ============================================================ */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.back-home-btn:hover {
    color: var(--color-primary);
    background: var(--color-surface-hover);
    border-color: var(--color-primary-glow);
    box-shadow: 0 0 12px var(--color-primary-glow);
}

.logo-img {
    height: 48px;
    width: auto;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}


h1 {
    font-size: 1.4em;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.82em;
    color: var(--color-text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--color-success);
    background: var(--color-success-glow);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(52, 211, 153, 0.2);
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ============================================================
   Converter Area (two panels + divider)
   ============================================================ */

.converter-area {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    align-items: stretch;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-normal);
}

.panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.panel-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.panel-output {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ============================================================
   Panel Divider (arrow between panels)
   ============================================================ */

.panel-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0;
    position: relative;
    z-index: 2;
}

.divider-arrow {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px var(--color-primary-glow);
    flex-shrink: 0;
    position: relative;
    z-index: 3;
}

.divider-arrow svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

/* ============================================================
   Panel Header
   ============================================================ */

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
}

.panel-header svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.panel-header label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.row-counter {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--color-success);
    background: var(--color-success-glow);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    display: none;
    animation: fadeIn 0.3s ease;
}

.row-counter.visible {
    display: inline-block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================================
   Textarea
   ============================================================ */

textarea#inputCoords {
    flex-grow: 1;
    padding: 16px;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.88em;
    line-height: 1.6;
    resize: none;
    outline: none;
    min-height: 380px;
}

textarea#inputCoords::placeholder {
    color: var(--color-text-dim);
    font-style: italic;
    line-height: 1.7;
}

textarea#inputCoords:focus {
    background: rgba(79, 143, 250, 0.02);
}

/* ============================================================
   Output Table Container
   ============================================================ */

#outputTableContainer {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

/* Custom scrollbar */
#outputTableContainer::-webkit-scrollbar {
    width: 6px;
}

#outputTableContainer::-webkit-scrollbar-track {
    background: transparent;
}

#outputTableContainer::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#outputTableContainer::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   Table
   ============================================================ */

#outputTable {
    width: 100%;
    border-collapse: collapse;
}

#outputTable th,
#outputTable td {
    padding: 10px 16px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.88em;
}

#outputTable thead th {
    background: var(--color-table-header);
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--color-border);
}

#outputTable tbody td {
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

#outputTable tbody tr:nth-child(even) td {
    background: var(--color-table-row-even);
}

#outputTable tbody tr:hover td {
    background: var(--color-table-row-hover);
}

/* Row enter animation */
#outputTable tbody tr {
    animation: rowSlideIn 0.3s ease-out backwards;
}

@keyframes rowSlideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   Status Message
   ============================================================ */

.status-message {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--color-text-dim);
    text-align: center;
}

.status-message svg {
    opacity: 0.3;
}

.status-message span {
    font-size: 0.88em;
    font-style: italic;
    line-height: 1.5;
}

.status-message.has-error {
    color: #f87171;
}

.status-message.has-error svg {
    stroke: #f87171;
    opacity: 0.5;
}

/* ============================================================
   Buttons
   ============================================================ */

#selectAllBtn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.78em;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

#selectAllBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    border-color: rgba(255, 255, 255, 0.15);
}

#selectAllBtn.copied {
    background: var(--color-success-glow);
    color: var(--color-success);
    border-color: rgba(52, 211, 153, 0.3);
}

button#convertBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 24px;
    margin-top: 0;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 16px var(--color-primary-glow);
    position: relative;
    overflow: hidden;
}

button#convertBtn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

button#convertBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(79, 143, 250, 0.35);
}

button#convertBtn:hover::before {
    opacity: 1;
}

button#convertBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

button#convertBtn svg {
    flex-shrink: 0;
}

/* ============================================================
   Footer
   ============================================================ */

.app-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.app-footer p {
    font-size: 0.78em;
    color: var(--color-text-dim);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

/* ============================================================
   Responsive (Mobile)
   ============================================================ */

@media (max-width: 768px) {
    body {
        padding: 16px 12px;
    }

    .app-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .converter-area {
        flex-direction: column;
    }

    .panel-input {
        border-radius: var(--radius-lg);
        border-right: 1px solid var(--color-border);
        border-bottom: none;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .panel-output {
        border-radius: var(--radius-lg);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    .panel-divider {
        width: 100%;
        height: 0;
    }

    .divider-arrow {
        transform: rotate(90deg);
    }

    textarea#inputCoords {
        min-height: 200px;
    }

    #outputTableContainer {
        min-height: 200px;
    }

    h1 {
        font-size: 1.2em;
    }
}

/* ============================================================
   Footer Link
   ============================================================ */

.footer-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: color var(--transition-fast);
    display: inline-block;
    margin-top: 8px;
}

.footer-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* ============================================================
   Modal (Terms and Privacy)
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 30, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #111b31;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.01);
}

.modal-header h2 {
    font-size: 1.15em;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 svg {
    color: var(--color-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.6em;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color var(--transition-fast);
}

.close-btn:hover {
    color: #fff;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Custom scrollbar for modal */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-section h3 {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--color-primary-hover);
    margin-bottom: 8px;
}

.modal-section p {
    font-size: 0.86em;
    color: var(--color-text-muted);
    line-height: 1.6;
    text-align: left;
    margin-bottom: 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    background: rgba(255, 255, 255, 0.01);
}

.modal-btn-primary {
    background: var(--color-primary);
    border: none;
    color: #fff;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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