/* ========================================
   SCIENTIFIC CALCULATOR - PREMIUM CSS
   Pink Theme with Glassmorphism
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for Themes */
:root {
    --primary: #FF69B4;
    --primary-light: #FFB6C1;
    --primary-lighter: #FFC0CB;
    --accent: #FF1493;
    --background: #fff5f7;
    --surface: rgba(255, 255, 255, 0.95);
    --surface-dark: rgba(255, 105, 180, 0.1);
    --text-primary: #2c2c2c;
    --text-secondary: #666;
    --border: rgba(255, 105, 180, 0.2);
    --shadow: 0 8px 32px rgba(255, 105, 180, 0.1);
    --shadow-lg: 0 20px 60px rgba(255, 105, 180, 0.15);
    --shadow-hover: 0 12px 48px rgba(255, 105, 180, 0.2);
}

/* Dark Mode */
body.dark-mode {
    --background: #1a1a2e;
    --surface: rgba(30, 30, 50, 0.95);
    --surface-dark: rgba(255, 105, 180, 0.05);
    --text-primary: #f0f0f0;
    --text-secondary: #aaa;
    --border: rgba(255, 105, 180, 0.1);
}

/* Theme Variants */
body[data-theme="glitter"] {
    --primary: #FF1493;
    --primary-light: #FF69B4;
    --accent: #FFB6C1;
}

body[data-theme="neon"] {
    --primary: #FF10F0;
    --primary-light: #00FF88;
    --accent: #00FFFF;
}

body[data-theme="rosegold"] {
    --primary: #B76E79;
    --primary-light: #D4A5A5;
    --accent: #E8B4B8;
}

body[data-theme="bubble"] {
    --primary: #FF69B4;
    --primary-light: #FFC0CB;
    --accent: #FFE4E1;
}

body[data-theme="sunset"] {
    --primary: #FF6B6B;
    --primary-light: #FFB6C1;
    --accent: #FFA07A;
}

html, body {
    width: 100%;
    min-height: 100vh;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

body {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scroll Bar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ========================================
   HEADER SECTION
   ======================================== */

.header {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    backdrop-filter: blur(10px);
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.pandas-container {
    display: flex;
    gap: 0.5rem;
}

.panda {
    font-size: 2.5rem;
    animation: float 3s ease-in-out infinite;
}

.panda-1 {
    animation-delay: 0s;
}

.panda-2 {
    animation-delay: 0.5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.particles {
    position: relative;
    width: 60px;
    height: 40px;
}

.particles::before,
.particles::after {
    content: '';
    position: absolute;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.particles::before {
    width: 8px;
    height: 8px;
    left: 10px;
    top: 10px;
    animation-delay: 0s;
}

.particles::after {
    width: 6px;
    height: 6px;
    right: 10px;
    top: 15px;
    animation-delay: 0.5s;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.logo-circle {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-title {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.3;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.download-btn {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.download-btn:active {
    transform: translateY(0);
}

.download-icon {
    animation: download-pulse 2s ease-in-out infinite;
}

@keyframes download-pulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(20deg);
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.main-container {
    display: flex;
    
    gap: 2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

/* ========================================
   CALCULATOR SECTION
   ======================================== */

.calculator-section {
    flex: 0 0 auto;
}

.calculator {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    max-width: 500px;
}

/* Display */
.display-container {
    margin-bottom: 1.5rem;
}

.display {
    width: 100%;
    background: linear-gradient(135deg, var(--surface-dark) 0%, rgba(0, 0, 0, 0.02) 100%);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.display:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.3);
}

.display-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: right;
    min-height: 1rem;
}

/* Control Buttons */
.control-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.btn-control {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.2);
}

.btn-control:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-control:active {
    transform: translateY(0);
}

/* Memory Buttons */
.memory-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.btn-memory {
    background: rgba(255, 105, 180, 0.1);
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    padding: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.btn-memory:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-memory:active {
    transform: translateY(0);
}

/* Buttons Grid */
.buttons-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-number {
    background: var(--surface-dark);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-number:hover {
    background: rgba(255, 105, 180, 0.15);
    transform: translateY(-2px);
}

.btn-operator {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 700;
}

.btn-operator:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-function {
    background: rgba(255, 105, 180, 0.12);
    color: var(--primary);
    border: 1px solid var(--primary);
    font-size: 0.85rem;
}

.btn-function:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-equals {
    background: linear-gradient(135deg, #FF1493 0%, #FF69B4 100%);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-equals:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 20, 147, 0.3);
}

.btn-copy,
.btn-share {
    background: rgba(255, 105, 180, 0.08);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1rem;
}

.btn-copy:hover,
.btn-share:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* ========================================
   SIDE PANELS
   ======================================== */

.side-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 280px;
}

.panel {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.panel-title {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Themes Panel */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.theme-option {
    padding: 1rem;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.theme-option.active {
    border-color: white;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.5);
}

.theme-label {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

 .tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
}

.tool-btn {
    padding: 0.5rem;
    height: 70px;
    min-height: 70px;
}


.tool-btn:hover {
    background: var(--primary);
    transform: scale(1.1) rotate(5deg);
}

.tool-btn:active {
    transform: scale(0.95);
}

/* History Panel */
.history-header {
    margin-bottom: 1rem;
}

.history-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.history-search {
    flex: 1;
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.history-search::placeholder {
    color: var(--text-secondary);
}

.history-btn {
    background: rgba(255, 105, 180, 0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem 0.8rem;
    transition: all 0.3s ease;
}

.history-btn:hover {
    background: #ff6b9d;
    color: white;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: var(--surface-dark);
    border-left: 3px solid var(--primary);
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.history-item:hover {
    background: rgba(255, 105, 180, 0.15);
    transform: translateX(5px);
}

.history-item-text {
    flex: 1;
    color: var(--text-secondary);
    word-break: break-all;
}

.history-item-result {
    color: var(--primary);
    font-weight: 600;
}

.history-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem;
    transition: all 0.3s ease;
}

.history-delete-btn:hover {
    color: #ff0000;
    transform: scale(1.2);
}

.history-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

/* Tool Container */
.tool-container {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tool-form h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.tool-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-input-group label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

.tool-input-group input,
.tool-input-group select {
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.tool-input-group input:focus,
.tool-input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.2);
}

.tool-button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.3);
}

.tool-result {
    background: var(--surface-dark);
    border-left: 3px solid var(--primary);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    color: var(--text-primary);
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    text-align: center;
    padding: 2rem;
    font-weight: 600;
    box-shadow: 0 -4px 15px rgba(255, 105, 180, 0.1);
    position: relative;
}

.footer-heart {
    font-size: 1.5rem;
    animation: heartbeat 1.5s ease-in-out infinite;
    margin-top: 0.5rem;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }

    .side-panels {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .history-panel {
        grid-column: 1 / -1;
    }

    .header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .app-title {
        font-size: 1.1rem;
    }

    .download-text {
        display: none;
    }

    .calculator {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .header-left {
        justify-content: center;
    }

    .header-center {
        order: -1;
    }

    .app-title {
        font-size: 1rem;
    }

    .download-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .main-container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .side-panels {
        grid-template-columns: 1fr;
    }

    .buttons-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.6rem;
    }

    .btn {
        padding: 0.8rem;
        font-size: 0.8rem;
    }

    .calculator {
        padding: 1.5rem;
        max-width: 100%;
    }

    .display {
        font-size: 1.5rem;
        padding: 0.8rem 1rem;
    }

    .themes-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .panda {
        font-size: 1.8rem;
    }

    .logo-circle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .app-title {
        font-size: 0.9rem;
    }

    .main-container {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .calculator {
        padding: 1rem;
    }

    .buttons-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .btn {
        padding: 0.6rem;
        font-size: 0.7rem;
    }

    .control-buttons,
    .memory-buttons {
        gap: 0.5rem;
    }

    .btn-control,
    .btn-memory {
        padding: 0.5rem;
        font-size: 0.7rem;
    }

    .display {
        font-size: 1.2rem;
        padding: 0.6rem 0.8rem;
    }

    .side-panels {
        gap: 1rem;
    }

    .panel {
        padding: 1rem;
    }

    .panel-title {
        font-size: 1rem;
    }

    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .theme-option {
        height: 60px;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tool-btn {
        padding: 0.8rem;
        font-size: 1.2rem;
    }

    .footer {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .footer-heart {
        font-size: 1.2rem;
    }
}

/* ========================================
   UTILITIES
   ======================================== */

.hidden {
    display: none;
}

.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .side-panels,
    .history-controls {
        display: none;
    }

    .calculator {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 0.3s ease;
}
