/* ===== DICEWARE GENERATOR - COMPLETE CSS ===== */

/* ===== RESET UND BASIS-STYLING ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

*:focus-visible {
    outline: 3px solid #3498db !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

/* ===== LANGUAGE SELECTOR ===== */
.language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.lang-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: #2c3e50;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lang-btn:focus-visible {
    outline-color: rgba(255, 255, 255, 0.8);
}

/* ===== HEADER ===== */
header {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 40px 20px;
    border-radius: 8px 8px 0 0;
    position: relative;
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 400;
}

/* ===== MAIN CONTENT ===== */
main {
    padding: 40px;
}

/* ===== CONTROLS ===== */
.controls {
    background: #fafafa;
    border-radius: 6px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.control-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    font-weight: 500;
    color: #2c3e50;
    min-width: 140px;
    display: flex;
    align-items: center;
}

.control-group input,
.control-group select {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    flex: 1;
    max-width: 200px;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #3498db;
}

/* ===== SECURITY INDICATOR ===== */
.security-indicator {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85em;
    text-align: center;
    min-width: 120px;
    border: 1px solid;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.security-indicator.weak {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-color: #e17055;
    color: #8b4513;
    animation: pulse-weak 2s infinite;
}

.security-indicator.medium {
    background: linear-gradient(135deg, #81ecec, #74b9ff);
    border-color: #0984e3;
    color: #2d3436;
}

.security-indicator.strong {
    background: linear-gradient(135deg, #55efc4, #00b894);
    border-color: #00a085;
    color: #2d3436;
}

.security-indicator.very-strong {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    border-color: #0756b3;
    color: white;
    box-shadow: 0 2px 8px rgba(9, 132, 227, 0.3);
}

.security-indicator.extreme {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border-color: #5f3dc4;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
    animation: glow-extreme 3s infinite;
}

@keyframes pulse-weak {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow-extreme {
    0%, 100% { box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4); }
    50% { box-shadow: 0 4px 16px rgba(108, 92, 231, 0.6); }
}

/* ===== GENERATE BUTTON ===== */
.generate-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover:not(:disabled) {
    background: #2980b9;
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.generate-btn:disabled::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 20px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== PRIVACY NOTICE ===== */
.privacy-notice {
    background: #f0f8f0;
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

.privacy-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.05em;
    color: #155724;
    font-weight: 600;
}

.privacy-icon {
    font-size: 1.3em;
}

.privacy-content p {
    margin: 6px 0;
    color: #155724;
    font-weight: 400;
}

/* ===== ERROR HANDLING ===== */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.error-message.show {
    display: block;
    opacity: 1;
}

.error-message::before {
    content: '⚠️ ';
    font-weight: bold;
}

/* ===== RANDOM OPTIONS ===== */
.random-options {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
    animation: slideDown 0.3s ease;
}

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

.sub-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}

.sub-control:last-child {
    margin-bottom: 10px;
}

.sub-control label {
    font-size: 0.9em;
    color: #495057;
    min-width: 120px;
    font-weight: 500;
}

.sub-control input,
.sub-control select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 0.9em;
}

/* ===== POSITION EXAMPLES ===== */
.position-examples {
    background: linear-gradient(135deg, #e9ecef, #f8f9fa);
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    border-left: 4px solid #6c757d;
    font-size: 0.9em;
}

.position-examples code {
    background: #fff;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    color: #495057;
    border: 1px solid #dee2e6;
    white-space: nowrap;
}

/* ===== CHECKBOX STYLING ===== */
.control-group label input[type="checkbox"] {
    margin-right: 8px;
}

/* ===== RESULTS ===== */
.results {
    background: #ffffff;
    border-radius: 6px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid #e0e0e0;
}

.security-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
}

.security-info h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #2c3e50;
}

.security-info p {
    margin: 6px 0;
    font-weight: 400;
}

.entropy-breakdown {
    font-style: italic;
    color: #6c757d;
    margin-top: 5px;
    font-size: 0.9em;
}

/* ===== PASSWORD DISPLAY ===== */
.passwords {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.password-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
    position: relative;
}

.password-item:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.password-number {
    background: #6c757d;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85em;
    flex-shrink: 0;
}

.password-text {
    flex: 1;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1em;
    word-break: break-all;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    line-height: 1.4;
    user-select: all;
    transition: border-color 0.2s ease;
}

.password-text:hover {
    border-color: #3498db;
}

/* ===== COPY BUTTON ===== */
.copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0.9em;
    position: relative;
    overflow: hidden;
}

.copy-btn:hover:not(.copied) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.copy-btn.copied {
    background: #17a2b8;
    animation: success-pulse 0.5s ease;
}

.copy-btn:active {
    transform: translateY(0);
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    font-weight: 500;
    font-size: 0.9em;
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s ease forwards, slideOut 0.3s ease 2.7s forwards;
}

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

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ===== EXPLANATION SECTION ===== */
.explanation {
    background: #f8f9fa;
    padding: 40px;
    border-top: 1px solid #e0e0e0;
}

.explanation h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8em;
    text-align: center;
    font-weight: 600;
}

.explanation-intro {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    border-left: 4px solid #3498db;
    border: 1px solid #e0e0e0;
}

.explanation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.explanation-item {
    background: white;
    padding: 25px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.explanation-item.full-width {
    grid-column: 1 / -1;
}

.explanation-item h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.explanation-item p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #495057;
}

.explanation-item ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.explanation-item li {
    margin-bottom: 6px;
    line-height: 1.5;
    color: #495057;
}

/* ===== FOOTER ===== */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 25px 20px;
    border-radius: 0 0 8px 8px;
}

footer p {
    margin: 4px 0;
    opacity: 0.9;
    font-size: 0.9em;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 6px;
    }
    
    header {
        padding: 30px 20px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .language-selector {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
        padding: 0 20px;
    }
    
    main {
        padding: 20px;
    }
    
    .controls {
        padding: 20px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .control-group label {
        min-width: auto;
        margin-bottom: 5px;
        text-align: left;
    }
    
    .control-group input,
    .control-group select {
        max-width: none;
    }
    
    .security-indicator {
        margin-top: 8px;
        width: 100%;
    }
    
    .sub-control {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sub-control label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .password-item {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .password-text {
        font-size: 0.9em;
        word-break: break-all;
        width: 100%;
    }
    
    .copy-btn {
        width: 100%;
        padding: 12px;
    }
    
    .explanation {
        padding: 20px;
    }
    
    .explanation-grid {
        grid-template-columns: 1fr;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        width: auto;
        text-align: center;
    }
    
    .lang-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.6em;
    }
    
    header p {
        font-size: 1em;
    }
    
    .controls {
        padding: 15px;
    }
    
    .results {
        padding: 20px;
    }
    
    .password-text {
        font-size: 0.85em;
    }
    
    .explanation {
        padding: 15px;
    }
    
    .position-examples code {
        display: block;
        margin: 2px 0;
        white-space: normal;
        word-break: break-all;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .security-indicator,
    .password-item,
    .copy-btn,
    .lang-btn {
        border-width: 3px;
        border-color: #000;
    }
    
    .control-group input,
    .control-group select {
        border: 3px solid #000;
    }
    
    .password-text:hover {
        border-color: #000;
        border-width: 3px;
    }
}

/* ===== MOTION PREFERENCES ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .toast {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .language-selector,
    .generate-btn,
    .copy-btn,
    .toast,
    .error-message {
        display: none !important;
    }
    
    .password-text {
        background: white !important;
        border: 2px solid #000 !important;
        padding: 10px !important;
    }
    
    .container {
        box-shadow: none !important;
        border: none !important;
    }
}
