/* ==========================================================================
   MINIMALIST UTILITY DESIGN SYSTEM (LIGHT THEME)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #f8fafc;        /* Slate 50 */
    --bg-card: #ffffff;        /* White */
    --border-color: #e2e8f0;   /* Slate 200 */
    --border-color-focus: #6366f1; /* Indigo 500 */
    
    /* Text Colors */
    --text-primary: #0f172a;   /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    --text-muted: #94a3b8;     /* Slate 400 */
    
    /* Accents & States */
    --color-indigo: #4f46e5;   /* Indigo 600 */
    --color-indigo-hover: #4338ca; /* Indigo 700 */
    --color-red: #ef4444;      /* Red 500 */
    --color-amber: #f59e0b;    /* Amber 500 */
    --color-emerald: #10b981;  /* Emerald 500 */
    --color-emerald-bg: #ecfdf5;
    --color-red-bg: #fef2f2;
    --color-amber-bg: #fffbeb;
    
    /* Constants */
    --border-radius: 12px;
    --border-radius-sm: 6px;
    --transition: all 0.2s ease;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

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

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.student-card {
    display: flex;
    flex-direction: column;
    text-align: right;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.student-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.student-group {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ==========================================================================
   LAYOUT GRID
   ========================================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 28px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Font Helper */
.number-font {
    font-family: 'Fira Code', monospace;
}

/* ==========================================================================
   ANALYZER SECTION
   ========================================================================== */

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#password-input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1; /* Slate 300 */
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

#password-input:focus {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#toggle-password-visibility {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: var(--transition);
}

#toggle-password-visibility:hover {
    color: var(--text-secondary);
}

/* Linear Strength Bar */
.strength-bar-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.strength-bar-track {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.strength-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--color-red);
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-verdict-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.verdict-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.entropy-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Characteristics Badge Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stat-item {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-indigo);
}

/* Character Pills */
.char-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.group-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.group-pill.active {
    background-color: #e0e7ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

/* Crack Time Table */
.crack-time-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.crack-time-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.table-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.crack-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.crack-table th, .crack-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.crack-table tr:last-child td {
    border-bottom: none;
}

.crack-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
}

.crack-table td.number-font {
    font-weight: 500;
}

.hash-type .sub-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
}

.device-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-name {
    font-weight: 600;
    color: var(--text-primary);
}

.device-speed {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Colors for cells */
.text-red { color: var(--color-red); }
.text-amber { color: var(--color-amber); }
.text-emerald { color: var(--color-emerald); }

/* ==========================================================================
   PASSWORD GENERATOR CARD
   ========================================================================== */

.result-display-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px 50px 16px 16px;
    min-height: 58px;
}

#generated-password-display {
    width: 100%;
    color: var(--color-indigo);
    font-weight: 700;
    font-size: 1.15rem;
    word-break: break-all;
    letter-spacing: 0.05em;
}

#copy-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

#copy-btn:hover {
    color: var(--text-secondary);
    background-color: #cbd5e1;
}

.generator-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.slider-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-label-container {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.length-number {
    color: var(--color-indigo);
    font-weight: 700;
}

/* Custom range slider */
.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background-color: var(--color-indigo);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    display: none;
}

.checkbox-box {
    width: 18px;
    height: 18px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.custom-checkbox input:checked + .checkbox-box {
    background-color: var(--color-indigo);
    border-color: var(--color-indigo);
}

.checkbox-box::after {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(-45deg) translate(1px, -1px);
    opacity: 0;
}

.custom-checkbox input:checked + .checkbox-box::after {
    opacity: 1;
}

.custom-checkbox:hover .checkbox-box {
    border-color: var(--color-indigo);
}

/* Primary buttons styling */
.primary-btn {
    background-color: var(--color-indigo);
    border: none;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

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

.primary-btn:active {
    transform: translateY(1px);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* ==========================================================================
   TOASTS
   ========================================================================== */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background-color: #1e293b; /* Slate 800 for toast contrast */
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.error {
    background-color: #991b1b;
}

.toast-success-icon { color: #34d399; }
.toast-error-icon { color: #f87171; }

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

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(4px); }
}

/* ==========================================================================
   RESPONSIVE LAYOUT
   ========================================================================== */

@media (max-width: 820px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
