/* ===========================
   Cypheria Brand Design System
   id.cypheria.io - Fingerprinting Tool
   Professional Light Theme
   =========================== */

/* Import Monda Font */
@import url('https://fonts.googleapis.com/css2?family=Monda:wght@400;700&display=swap');

/* ===========================
   CSS Variables - Cypheria Palette
   =========================== */
:root {
    /* Brand Colors */
    --cypheria-gold: #b69e70;
    --gold-light: #d4c4a8;
    --gold-dark: #9a8560;
    
    /* Base Colors */
    --bg-page: #ffffff;
    --bg-secondary: #fafafa;
    --bg-card: #ffffff;
    --bg-card-hover: #f9f9f9;
    
    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #8a8a8a;
    --text-on-gold: #ffffff;
    
    /* Borders & Dividers */
    --border-default: 1px solid #e5e5e5;
    --border-accent: 2px solid var(--cypheria-gold);
    --border-muted: 1px solid #f0f0f0;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-gold: 0 4px 16px rgba(182, 158, 112, 0.15);
    
    /* Status Colors */
    --status-success: #2d7a3e;
    --status-warning: #d97706;
    --status-danger: #c53030;
    --status-info: #2563eb;
    
    /* Spacing Scale */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Typography */
    --font-display: 'Monda', sans-serif;
    --font-body: 'Monda', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

/* ===========================
   Global Reset & Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--space-lg);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    color: var(--cypheria-gold);
    margin-bottom: var(--space-sm);
    font-weight: 900;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
    color: var(--cypheria-gold);
}

h3 {
    font-size: 1.25rem;
    margin: var(--space-lg) 0 var(--space-sm) 0;
    color: var(--cypheria-gold);
    font-weight: 700;
}

p {
    margin-bottom: var(--space-md);
}

/* ===========================
   Header / Hero Section
   =========================== */
header {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    margin-bottom: var(--space-xl);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-default);
    box-shadow: var(--shadow-md);
    position: relative;
}

/* Gold accent bar at top */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cypheria-gold);
}

header h1 {
    margin-bottom: var(--space-sm);
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
}

.branding {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(135deg, var(--cypheria-gold) 0%, var(--gold-dark) 100%);
    color: var(--text-on-gold);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-lg);
}

.info-note {
    margin-top: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-left: 4px solid var(--cypheria-gold);
    border-radius: var(--radius-md);
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-note strong {
    color: var(--cypheria-gold);
    font-weight: 600;
}

/* ===========================
   Fingerprint Hash Section
   =========================== */
.fingerprint-hash {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-accent);
    box-shadow: var(--shadow-gold);
    position: relative;
    /* Disable all animations for fingerprint hash */
    animation: none !important;
    opacity: 1 !important;
}

.fingerprint-hash h3 {
    margin: 0 0 var(--space-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.fingerprint-hash .hash-value {
    display: block;              /* Ensure proper block-level rendering */
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--cypheria-gold);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    word-break: break-all;
    overflow-wrap: break-word;   /* Better text wrapping */
    line-height: 1.6;            /* Proper line spacing */
    margin: var(--space-md) 0;
    border: var(--border-muted);
    /* Disable all animations for hash value */
    animation: none !important;
    opacity: 1 !important;
    transition: none !important;
}

.fingerprint-hash details {
    margin-top: var(--space-md);
}

.fingerprint-hash summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.fingerprint-hash summary:hover {
    background: var(--bg-secondary);
    color: var(--cypheria-gold);
}

/* ===========================
   Section Dividers
   =========================== */
.section-divider {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 2px solid var(--cypheria-gold);
    text-align: center;
}

.section-divider h2 {
    margin-bottom: var(--space-sm);
}

.section-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ===========================
   Summary Panel (Featured)
   =========================== */
.summary-panel {
    margin-bottom: var(--space-xl);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-accent);
    box-shadow: var(--shadow-gold);
    overflow: hidden;
}

.summary-panel summary {
    padding: var(--space-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(182, 158, 112, 0.05) 0%, rgba(182, 158, 112, 0.02) 100%);
    transition: all 0.3s ease;
}

.summary-panel summary:hover {
    background: linear-gradient(135deg, rgba(182, 158, 112, 0.1) 0%, rgba(182, 158, 112, 0.05) 100%);
}

.summary-panel summary .icon {
    font-size: 1.5rem;
}

.summary-panel summary .title {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cypheria-gold);
    font-family: var(--font-display);
    margin-left: var(--space-md);
}

.summary-panel summary::after {
    content: '▼';
    color: var(--cypheria-gold);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.summary-panel[open] summary::after {
    transform: rotate(180deg);
}

.summary-panel .content {
    padding: var(--space-lg);
    background: var(--bg-page);
    border-top: var(--border-muted);
}

/* ===========================
   Category Cards (Collapsible)
   =========================== */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-default);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gold-light);
}

.panel summary {
    padding: var(--space-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    background: var(--bg-card);
    transition: all 0.3s ease;
    user-select: none;
}

.panel summary:hover {
    background: var(--bg-card-hover);
}

.panel summary::after {
    content: '▼';
    color: var(--cypheria-gold);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.panel[open] summary::after {
    transform: rotate(180deg);
}

.panel summary .icon {
    font-size: 1.25rem;
    color: var(--cypheria-gold);
}

.panel summary .title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.panel summary .status {
    font-size: 1rem;
    margin-left: auto;
}

.panel .content {
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-top: var(--border-muted);
}

/* ===========================
   Tables
   =========================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: var(--border-muted);
}

thead {
    background: linear-gradient(135deg, rgba(182, 158, 112, 0.08) 0%, rgba(182, 158, 112, 0.04) 100%);
    border-bottom: var(--border-default);
}

thead th {
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--cypheria-gold);
    font-size: 0.875rem;
    letter-spacing: 0.3px;
}

tbody tr {
    border-bottom: var(--border-muted);
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--bg-secondary);
}

tbody tr:last-child {
    border-bottom: none;
}

td {
    padding: var(--space-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

td:first-child {
    font-weight: 500;
    color: var(--text-primary);
    width: 40%;
}

td:last-child {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ===========================
   Status Indicators
   =========================== */
.status-ok,
.status-available {
    color: var(--status-success);
    font-weight: 600;
}

.status-blocked {
    color: var(--status-danger);
    font-weight: 600;
}

.status-warning {
    color: var(--status-warning);
    font-weight: 600;
}

.status-neutral {
    color: #8b7d00;
    font-weight: 600;
}

.status-info {
    color: var(--status-info);
    font-weight: 600;
}

/* ===========================
   Buttons
   =========================== */
button,
.permission-btn,
.reveal-btn {
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-page);
    color: var(--cypheria-gold);
    border: 2px solid var(--cypheria-gold);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

button:hover,
.permission-btn:hover,
.reveal-btn:hover {
    background: var(--cypheria-gold);
    color: var(--text-on-gold);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

button:active,
.permission-btn:active,
.reveal-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

button:disabled {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Button Container */
.button-container {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.export-buttons {
    display: flex;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===========================
   Warning & Alert Boxes
   =========================== */
.warning-box {
    padding: var(--space-md);
    background: rgba(197, 48, 48, 0.05);
    border-left: 4px solid var(--status-danger);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
    box-shadow: var(--shadow-sm);
}

.warning-box strong {
    color: var(--status-danger);
    font-weight: 600;
}

.info-box {
    padding: var(--space-md);
    background: rgba(37, 99, 235, 0.05);
    border-left: 4px solid var(--status-info);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
}

/* ===========================
   Sensitive Data Display
   =========================== */
.sensitive-data {
    color: var(--cypheria-gold);
    font-weight: 600;
}

.hidden-value {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border: var(--border-muted);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.revealed-value {
    color: var(--text-primary);
    font-weight: 500;
}

.data-source {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    font-style: italic;
}

/* ===========================
   Footer
   =========================== */
footer {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    margin-top: var(--space-2xl);
    color: var(--text-muted);
    border-top: var(--border-default);
    font-size: 0.9rem;
}

footer p {
    margin: var(--space-xs) 0;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    body {
        padding: var(--space-sm);
    }

    header {
        padding: var(--space-lg);
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }

    .panel summary,
    .summary-panel summary {
        padding: var(--space-md);
        flex-wrap: wrap;
    }

    .content {
        padding: var(--space-md);
    }

    td {
        padding: var(--space-sm);
        font-size: 0.85rem;
    }

    button,
    .permission-btn {
        width: 100%;
        padding: var(--space-sm);
    }

    .button-container {
        flex-direction: column;
    }

    .fingerprint-hash {
        padding: var(--space-sm) var(--space-md);
        margin-bottom: var(--space-lg);
    }
    
    .fingerprint-hash h3 {
        font-size: 0.95rem;
        flex-direction: row;
        align-items: center;
        gap: var(--space-xs);
        margin-bottom: var(--space-sm);
    }
    
    .fingerprint-hash p {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    .fingerprint-hash .hash-value {
        display: block;                 /* Ensure proper block-level rendering */
        font-size: 0.7rem;
        padding: var(--space-sm);
        word-break: break-all;
        overflow-wrap: break-word;
        line-height: 1.8;              /* Increased for better line spacing */
        letter-spacing: 0.03em;        /* Slightly more spacing */
        max-width: 100%;
        overflow-x: auto;
        white-space: normal;           /* Changed from pre-wrap for better wrapping */
        margin: var(--space-sm) 0;     /* Vertical spacing */
    }
    
    .fingerprint-hash details {
        margin-top: var(--space-sm);
    }
    
    .fingerprint-hash summary {
        font-size: 0.8rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .fingerprint-hash details div {
        font-size: 0.8rem;
    }
    
    .fingerprint-hash details ul {
        padding-left: var(--space-md);
    }
    
    .fingerprint-hash details li {
        font-size: 0.75rem;
        line-height: 1.6;
        margin-bottom: var(--space-xs);
    }
    
    .section-divider h2 {
        font-size: 1.25rem;
    }
    
    .section-note {
        font-size: 0.8rem;
    }
}

/* ===========================
   Animations (Subtle & Professional)
   =========================== */

/* Fade in from bottom (subtle) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Spinner Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Loading Icon (Inline Spinner) */
.loading-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2.5px solid rgba(182, 158, 112, 0.2);
    border-top-color: var(--cypheria-gold);
    border-right-color: var(--cypheria-gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-top: -2px;
    flex-shrink: 0;
}

/* Loading icon in table cells */
td .loading-icon,
span .loading-icon {
    vertical-align: text-bottom;
}

/* Ensure parent elements display properly with spinner */
span:has(.loading-icon),
td:has(.loading-icon) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Special handling for hash value with spinner */
.hash-value.loading,
.hash-value:has(.loading-icon) {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Make spinner more prominent in hash context */
.hash-value .loading-icon {
    width: 18px;
    height: 18px;
    border-width: 3px;
    flex-shrink: 0;
}

/* Alternative: Pulsing dots loading indicator */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
}

.loading-dots span {
    width: 4px;
    height: 4px;
    background: var(--cypheria-gold);
    border-radius: 50%;
    animation: pulse-dot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Default panel animation (DISABLED - causing page-wide blinking) */
.panel {
    /* animation: fadeInUp 0.4s ease forwards; */
    animation: none; /* Disabled to prevent blinking */
}

/* Disable CSS animations when Anime.js is loaded */
body.anime-loaded * {
    animation: none !important;
}

body.anime-loaded .panel {
    animation: none !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    button,
    .panel,
    summary {
        transition: none !important;
    }
}

/* Smooth transitions for interactive elements */
button,
.permission-btn,
.reveal-btn,
summary {
    transition: all 0.3s ease;
}

/* Subtle highlight for changed values */
.value-changed {
    background-color: rgba(182, 158, 112, 0.1);
    transition: background-color 1s ease;
}

/* ===========================
   Utility Classes
   =========================== */
.text-gold {
    color: var(--cypheria-gold);
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--status-danger);
}

.text-success {
    color: var(--status-success);
}

.text-center {
    text-align: center;
}

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* ===========================
   Geolocation Map Styles
   =========================== */
#geolocation-map-container {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: var(--border-muted);
}

#geolocation-map {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-md);
    border: var(--border-default);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-sm);
}

.maps-link {
    display: inline-block;
    padding: var(--space-sm) var(--space-md);
    background: var(--cypheria-gold);
    color: var(--text-on-gold);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9em;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.maps-link:hover {
    background: var(--gold-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.maps-link:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Responsive map on smaller screens */
@media (max-width: 768px) {
    #geolocation-map {
        height: 250px;
    }
}

@media (max-width: 480px) {
    #geolocation-map {
        height: 200px;
    }
    
    .maps-link {
        display: block;
        width: 100%;
    }
}

/* ===========================
   Scrollbar Styling (Webkit)
   =========================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--cypheria-gold);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dark);
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    body {
        background: white;
    }
    
    .panel {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    button,
    .permission-btn {
        display: none;
    }
}
