/* =====================================================
   GLOBAL STYLES & CSS RESET
   - CSS Reset untuk konsistensi cross-browser
   - Base styling untuk body dan layout utama
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f1f5f9;
    background-image: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* =====================================================
   MAIN CONTAINER
   - Wrapper utama untuk seluruh aplikasi kalkulator
   - Card design dengan shadow dan rounded corners
   ===================================================== */
.calculator-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

/* =====================================================
   HEADER SECTION
   - Area judul dan deskripsi aplikasi
   - Gradient background untuk visual appeal
   ===================================================== */
.calculator-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 32px 28px;
    text-align: left;
    color: white;
}

.calculator-header h1 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.calculator-header p {
    font-size: 14px;
    font-weight: 400;
    color: #94a3b8;
}

/* =====================================================
   MAIN CONTENT AREA
   - Container untuk input, tombol, dan hasil
   - Padding konsisten untuk spacing
   ===================================================== */
.calculator-body {
    padding: 32px 28px;
}

/* =====================================================
   INPUT FIELDS SECTION
   - Styling untuk form input angka
   - Focus states dan placeholder styling
   ===================================================== */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s ease;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 500;
}

/* Input focus state - border color dan shadow */
.input-group input:focus {
    outline: none;
    border-color: #334155;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Input placeholder styling */
.input-group input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* =====================================================
   OPERATION BUTTONS SECTION
   - Grid layout untuk 4 tombol operasi
   - Interactive states: hover, active, focus
   ===================================================== */
.operation-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 28px 0;
}

/* Base styling untuk tombol operasi */
.btn-operation {
    aspect-ratio: 1;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #ffffff;
}

/* Icon styling untuk tombol operasi */
.btn-operation .icon {
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

/* Text styling untuk tombol operasi */
.btn-operation .text {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* =====================================================
   CSS CUSTOM PROPERTIES
   - Centralized color scheme untuk tombol operasi
   - Mudah di-maintain dan customize
   ===================================================== */
:root{
    --op-base: #334155;       /* Warna dasar tombol */
    --op-base-dark: #1e293b;  /* Warna gradient lebih gelap */
    --op-active: #0f172a;     /* Warna saat tombol aktif/dipilih */
    --op-text: #ffffff;       /* Warna text tombol */
    --op-ring: rgba(99,102,241,0.18); /* Warna focus ring */
}

/* Enhanced styling untuk tombol operasi dengan CSS variables */
.btn-operation {
    color: var(--op-text);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 10px 30px rgba(2,6,23,0.12);
    background-image: linear-gradient(180deg, var(--op-base) 0%, var(--op-base-dark) 100%);
    background-size: 200% 200%;
    text-shadow: 0 1px 0 rgba(0,0,0,0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-position 0.3s ease;
}

/* Hover state - efek lift untuk visual feedback */
.btn-operation:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(16,24,40,0.25);
}

/* Active/selected state - untuk indikasi tombol yang dipilih */
.btn-operation.active,
.btn-operation.selected,
.btn-operation[aria-pressed="true"] {
    background-image: linear-gradient(180deg, var(--op-active) 0%, var(--op-base) 100%);
    box-shadow: 0 22px 52px rgba(2,6,23,0.36);
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255,255,255,0.08);
}

/* Active state - efek pressed saat tombol diklik */
.btn-operation:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 6px 14px rgba(2,6,23,0.12);
}

/* Focus state - styling untuk keyboard navigation */
.btn-operation:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--op-ring);
}

/* Icon styling - drop shadow untuk better contrast */
.btn-operation .icon {
    filter: drop-shadow(0 1px 0 rgba(0,0,0,0.18));
}

/* =====================================================
   RESULT DISPLAY SECTION
   - Container untuk menampilkan hasil perhitungan
   - Animasi pulse untuk feedback visual
   ===================================================== */
.result-container {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 24px;
    margin: 28px 0;
    border: 2px solid #e2e8f0;
}

/* Label untuk hasil */
.result-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Nilai hasil dengan font besar */
.result-value {
    font-size: 36px;
    font-weight: 700;
    color: #1e293b;
    word-break: break-word;
    transition: all 0.2s ease;
}

/* Animasi pulse saat hasil diperbarui */
.result-value.updated {
    animation: pulse 0.3s ease;
}

/* Keyframe animation untuk pulse effect */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Error state styling untuk hasil */
.result-value.error {
    color: #dc2626;
    font-size: 17px;
    font-weight: 600;
}

/* =====================================================
   RESET BUTTON SECTION
   - Tombol untuk menghapus semua input
   - Hover animation dengan rotasi icon
   ===================================================== */
.btn-reset {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #475569;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Icon reset dengan animasi rotasi */
.btn-reset span:first-child {
    font-size: 20px;
    transition: transform 0.4s ease;
}

/* Hover state untuk tombol reset */
.btn-reset:hover {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 41, 59, 0.3);
}

/* Rotasi icon saat hover */
.btn-reset:hover span:first-child {
    transform: rotate(-360deg);
}

/* Active state untuk tombol reset */
.btn-reset:active {
    transform: scale(0.98);
}

/* =====================================================
   NOTIFICATION SYSTEM
   - Toast notifications untuk success/error messages
   - Fixed positioning dengan animasi slide
   ===================================================== */
/* Success notification styling */
.success-notification {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 16px 28px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    z-index: 10000;
    animation: slideDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Error notification styling */
.error-notification {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 16px 28px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    z-index: 10000;
    animation: slideDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Fade out animation untuk notifikasi */
.success-notification.fade-out,
.error-notification.fade-out {
    animation: slideUp 0.3s ease forwards;
}

/* Icon styling untuk notifikasi */
.notif-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

/* Success icon styling */
.success-notification .notif-icon {
    background: white;
    color: #10b981;
}

/* Error icon styling */
.error-notification .notif-icon {
    background: white;
    color: #ef4444;
}

/* Text styling untuk notifikasi */
.notif-text {
    color: white;
    letter-spacing: 0.3px;
}

/* Slide down animation untuk notifikasi masuk */
@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Slide up animation untuk notifikasi keluar */
@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
}

/* =====================================================
   RESPONSIVE DESIGN
   - Mobile-first approach
   - Breakpoints: tablet (768px) dan small mobile (400px)
   ===================================================== */
/* Tablet breakpoint (768px) */
@media (max-width: 768px) {
    .calculator-container {
        max-width: 100%;
    }

    .calculator-header {
        padding: 28px 24px;
    }

    .calculator-header h1 {
        font-size: 24px;
    }

    .calculator-body {
        padding: 28px 24px;
    }

    .operation-buttons {
        gap: 10px;
    }

    .btn-operation .icon {
        font-size: 22px;
    }

    .btn-operation .text {
        font-size: 10px;
    }

    .result-value {
        font-size: 32px;
    }

    /* Mobile notification styling */
    .success-notification,
    .error-notification {
        top: 20px;
        left: 20px;
        right: 20px;
        transform: none;
        font-size: 14px;
        padding: 14px 20px;
    }
    
    /* Mobile slide animations */
    @keyframes slideDown {
        from {
            transform: translateY(-100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(-100px);
            opacity: 0;
        }
    }
}

/* Small mobile breakpoint (400px) */
@media (max-width: 400px) {
    body {
        padding: 16px;
    }

    .calculator-header h1 {
        font-size: 22px;
    }

    .calculator-body {
        padding: 24px 20px;
    }

    .result-value {
        font-size: 28px;
    }

    .btn-operation .text {
        font-size: 9px;
    }
}