/* Base Styles with CSS Variables for Better Theming */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Tokens */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --success-color: #10b981;
    --error-color: #ef4444;
    
    /* Theme Tokens - Light */
    --bg-color: #ffffff;
    --bg-offset: #f8fafc;
    --text-color: #1e1e1e;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    /* Transition for Theme Switching */
    --transition-speed: 0.3s;
}

.dark-mode {
    /* Theme Tokens - Dark */
    --bg-color: #1e293b;
    --bg-offset: #0f172a;
    --text-color: #f1f1f1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --card-bg: #334155;
    --input-bg: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

.hash-generator-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed) ease, 
                color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
}

.hash-generator-container {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px var(--shadow-color);
    max-width: 900px;
    margin: 20px auto;
}

/* Header */
.hash-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 2rem;
    text-align: center;
    position: relative;
    color: white;
}

.hash-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hash-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.theme-icon {
    width: 24px;
    height: 24px;
    color: white;
}

/* Main Content */
.hash-content {
    padding: 2rem;
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark-mode .section-title {
    color: #a5b4fc;
}

.section-icon {
    width: 20px;
    height: 20px;
}

.input-container {
    position: relative;
}

.hash-textarea {
    width: 100%;
    height: 120px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    resize: none;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.hash-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Algorithm Selection */
.algorithm-section {
    background: var(--bg-offset);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.algorithm-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: 2px solid transparent;
    text-align: center;
}

.algorithm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.algorithm-card.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.dark-mode .algorithm-card.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

.algorithm-radio {
    display: none;
}

.algorithm-name {
    font-weight: 600;
    font-size: 1rem;
    margin-top: 0.5rem;
    color: var(--text-color);
}

.algorithm-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Options Section */
.options-section {
    background: var(--bg-offset);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.option-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.option-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-label {
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-color);
}

.hmac-key-container {
    grid-column: 1 / -1;
    margin-top: 1rem;
    display: none;
}

.hmac-key-container.visible {
    display: block;
}

.hmac-key-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.hmac-key-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: none;
    min-width: 160px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary-dark);
    border: 2px solid var(--border-color);
}

.dark-mode .btn-secondary {
    color: #e2e8f0;
}

.btn-secondary:hover {
    background: var(--bg-offset);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--shadow-color);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* Result Section */
.result-section {
    margin-bottom: 2rem;
}

.result-container {
    position: relative;
}

.hash-result {
    width: 100%;
    min-height: 60px;
    padding: 1rem;
    background: var(--bg-offset);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    resize: none;
    word-break: break-all;
    color: var(--text-color);
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.copy-btn:hover {
    background: var(--bg-offset);
    transform: scale(1.05);
}

.copy-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-dark);
}

.dark-mode .copy-icon {
    color: #e2e8f0;
}

/* All Hashes Section */
.all-hashes-section {
    display: none;
    margin-top: 2rem;
}

.all-hashes-section.visible {
    display: block;
}

.all-hashes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.hash-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
}

.hash-card:hover {
    box-shadow: 0 5px 15px var(--shadow-color);
}

.hash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.hash-card-title {
    font-weight: 600;
    color: var(--primary-dark);
}

.dark-mode .hash-card-title {
    color: #a5b4fc;
}

.hash-card-copy {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dark-mode .hash-card-copy {
    color: #818cf8;
}

.hash-card-value {
    font-family: 'Courier New', monospace;
    background: var(--bg-offset);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--text-color);
}

/* Footer */
.hash-footer {
    background: var(--bg-offset);
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-speed) ease;
    z-index: 1000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.error {
    background: var(--error-color);
}

.notification-icon {
    width: 24px;
    height: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hash-content {
        padding: 1.5rem;
    }
    
    .hash-title {
        font-size: 1.8rem;
    }
    
    .algorithm-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .action-btn {
        min-width: 140px;
    }
}

@media (max-width: 576px) {
    .hash-content {
        padding: 1rem;
    }
    
    .hash-title {
        font-size: 1.5rem;
    }
    
    .hash-subtitle {
        font-size: 1rem;
    }
    
    .algorithm-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
    }
}

/* Extra Small Screens */
@media (max-width: 400px) {
    .algorithm-grid {
        grid-template-columns: 1fr;
    }
    
    .hash-title {
        font-size: 1.3rem;
    }
    
    .hash-subtitle {
        font-size: 0.9rem;
    }
}