/* CipherLab Design System */
:root {
    /* Cipher Colors */
    --cipher-purple: #7c3aed;
    --cipher-purple-light: #8b5cf6;
    --cipher-purple-dark: #6d28d9;
    --cipher-teal: #06b6d4;
    --cipher-teal-light: #0891b2;
    --cipher-gold: #f59e0b;
    --cipher-gold-light: #fbbf24;
    
    /* Caesar Theme Colors */
    --caesar-red: #dc2626;
    --caesar-gold: #d97706;
    --caesar-cream: #fef3c7;
    --caesar-dark: #1f2937;
    
    /* Surface Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --surface-elevated: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: rgba(124, 58, 237, 0.2);
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(124, 58, 237, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(124, 58, 237, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(124, 58, 237, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(124, 58, 237, 0.1);
    
    /* Border Radius */
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--caesar-cream) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--caesar-red) 0%, var(--caesar-gold) 50%, var(--cipher-purple) 100%);
    color: white;
    padding: var(--space-3xl) var(--space-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="10" y="20" font-size="8" fill="%23ffffff" opacity="0.1">CAESAR</text><text x="60" y="40" font-size="6" fill="%23ffffff" opacity="0.1">CIPHER</text><text x="20" y="60" font-size="7" fill="%23ffffff" opacity="0.1">ROME</text><text x="70" y="80" font-size="5" fill="%23ffffff" opacity="0.1">DECRYPT</text></svg>') repeat;
    animation: float-text 20s linear infinite;
    pointer-events: none;
}

@keyframes float-text {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(-100px) translateY(-100px); }
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    margin-bottom: var(--space-lg);
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto var(--space-xl);
    line-height: 1.6;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--cipher-gold);
    color: var(--caesar-dark);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* Educational Section */
.educational-section {
    background: var(--surface-elevated);
    margin: calc(-1 * var(--space-xl)) var(--space-lg) var(--space-2xl);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cipher-purple);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}
.info-card {
    background: linear-gradient(135deg, var(--cipher-purple) 0%, var(--cipher-teal) 100%);
    color: white;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    transform: translateY(0);
    transition: var(--transition);
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.info-card-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.info-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.info-card-text {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Calculator Layout */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-3xl);
}

.calculator-panel {
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cipher-purple);
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Mode Selector */
.mode-selector {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border-color);
}
.mode-button {
    flex: 1;
    padding: var(--space-md);
    border: none;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    color: var(--text-secondary);
}

.mode-button.active {
    background: var(--cipher-purple);
    color: white;
    box-shadow: var(--shadow-sm);
}

.mode-button:hover:not(.active) {
    background: rgba(124, 58, 237, 0.1);
    color: var(--cipher-purple);
}

/* Input Controls */
.input-group {
    margin-bottom: var(--space-xl);
}

.input-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.input-field {
    width: 100%;
    padding: var(--space-lg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    min-height: 120px;
    resize: vertical;
    transition: var(--transition);
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--cipher-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.shift-control {
    margin-bottom: var(--space-lg);
}

.shift-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--cipher-purple), var(--cipher-teal));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.shift-slider::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-elevated);
    border: 3px solid var(--cipher-purple);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.shift-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-elevated);
    border: 3px solid var(--cipher-purple);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.shift-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
}

.shift-value {
    background: linear-gradient(135deg, var(--cipher-purple), var(--cipher-teal));
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1.125rem;
}

.alphabet-preview {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
}

/* Results Panel */
.output-field {
    background: var(--bg-secondary);
    border: 2px solid var(--cipher-teal);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--cipher-purple);
    min-height: 120px;
}

.output-field:focus {
    border-color: var(--cipher-teal);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}
.btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cipher-purple), var(--cipher-purple-light));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--cipher-purple);
}

/* Examples Section */
.examples-section {
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    margin-bottom: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.example-card {
    background: linear-gradient(135deg, var(--caesar-cream), #ffffff);
    border: 2px solid var(--caesar-gold);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: var(--transition);
}

.example-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--caesar-red);
}
.example-title {
    font-weight: 700;
    color: var(--caesar-red);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.example-content {
    font-family: monospace;
    background: rgba(220, 38, 38, 0.1);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    margin: var(--space-sm) 0;
}

.example-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-layout {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .examples-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: var(--space-2xl) var(--space-lg);
    }

    .educational-section {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

/* Share Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    position: relative;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cipher-purple);
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--caesar-red);
    transform: rotate(90deg);
}

.share-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
}

.share-modal-button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.share-modal-button:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--cipher-purple);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.share-modal-icon {
    font-size: 2rem;
    color: var(--cipher-teal);
}