/* ===== Base Styles ===== */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #000000;
    --error-color: #ea4335;
    --text-color: #ffffff;
    --bg-color: #5d2020;
    --card-bg: #12774d;
    --border-color: #fbff05;
    --shadow-color: rgba(5, 65, 15, 0.5);
    --hover-color: #349750;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== Background Animation ===== */
.symbolic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(135deg, #1f1d1d 0%, #043037 100%);
}

.symbolic-background span {
    position: absolute;
    color: #00ff65;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 8px #c4bdbd;
    animation: float 18s infinite ease-out;
    opacity: 0;
    animation-fill-mode: both;
    will-change: transform, opacity;
}

/* Symbol definitions */
.symbolic-background span:nth-child(1) { content: "{}"; left: 5%; animation-delay: 0s; }
.symbolic-background span:nth-child(2) { content: "</>"; left: 15%; animation-delay: 1.5s; }
.symbolic-background span:nth-child(3) { content: "∞"; left: 25%; animation-delay: 3s; }
.symbolic-background span:nth-child(4) { content: "π"; left: 35%; animation-delay: 4.5s; }
.symbolic-background span:nth-child(5) { content: "∑"; left: 45%; animation-delay: 6s; }
.symbolic-background span:nth-child(6) { content: "Ω"; left: 55%; animation-delay: 7.5s; }
.symbolic-background span:nth-child(7) { content: "≠"; left: 65%; animation-delay: 9s; }
.symbolic-background span:nth-child(8) { content: "≡"; left: 75%; animation-delay: 10.5s; }
.symbolic-background span:nth-child(9) { content: "∫"; left: 85%; animation-delay: 12s; }
.symbolic-background span:nth-child(10) { content: "∆"; left: 95%; animation-delay: 13.5s; }

@keyframes float {
    0% {
        transform: translateY(110vh) rotate(10deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}

/* ===== Preloader Styles ===== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.math-symbols {
    display: flex;
    gap: 1.5rem;
}

.math-symbols span {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 12px rgba(100, 200, 255, 0.5);
    animation: pulse 1.8s infinite ease-in-out;
    font-family: 'Courier New', monospace;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        text-shadow: 0 0 12px rgba(100, 200, 255, 0.5);
    }
    50% { 
        transform: scale(1.3);
        text-shadow: 0 0 20px rgba(100, 200, 255, 0.8);
        color: rgba(255, 255, 255, 1);
    }
}

/* ===== Main Container ===== */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.converter-card {
    width: 100%;
    max-width: 700px;
    margin: 40px auto;
    background-color: rgb(17 34 10 / 96%);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Roboto Mono', monospace;
    color: var(--text-color);
}

.converter-card h4 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* ===== Input/Output Sections ===== */
.input-section, .output-section {
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.select-box, .input-field {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #333;
}

.select-box:focus, .input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.result-field {
    background-color: #ffffff;
    color: #333;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    height: 1rem;
    display: block;
    min-height: 1rem;
}

/* ===== Button Styles ===== */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.action-button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 5px;
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.action-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
}

.action-button.secondary {
    background-color: #727171;
    color: var(--text-color);
}

.action-button.secondary:hover {
    background-color: #dddddd;
    color: #333;
}

.copy-button {
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
    background-color: rgb(29 34 10 / 96%);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Roboto Mono', monospace;
    color: var(--text-color);
}

.copy-button:hover {
    background-color: var(--hover-color);
}

.copy-text, .copy-success {
    transition: all 0.3s ease;
}

.copy-success {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.copy-button.copied .copy-text {
    opacity: 0;
}

.copy-button.copied .copy-success {
    opacity: 1;
}

/* ===== History Section ===== */
.history-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.history-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    font-size: 0.75rem;
    color: #908f8f;
    min-width: 60px;
}

.history-conversion {
    flex: 1;
    margin: 0 1rem;
    font-size: 0.875rem;
    color: var(--text-color);
}

.history-use-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-use-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.no-history {
    color: #908f8f;
    text-align: center;
    padding: 1rem;
    font-style: italic;
}

/* ===== Rounded Box Styles ===== */
.rounded-box {
    width: 100%;
    max-width: 290px;
    margin: 15px auto;
    background-color: rgb(7 14 25 / 67%);
    border: 2px solid var(--border-color);
    border-radius: 1.5px;
    padding: 2.0px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Roboto Mono', monospace;
    color: var(--text-color);
}

.rounded-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin: 10px 0;
    transition: color 0.3s;
}

.rounded-box a:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .converter-card {
        padding: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-time {
        margin-bottom: 0.25rem;
    }
    
    .history-conversion {
        margin: 0.5rem 0;
    }
    
    .history-use-btn {
        align-self: flex-end;
        margin-top: 0.5rem;
    }
    
    .math-symbols span {
        font-size: 2rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}
