/* --- Global Resets & Base Styles --- */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    background: linear-gradient(135deg, #f0f2f5 0%, #c9d6ff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* --- Main Container (800x450) --- */
.calculator-app {
    width: 800px;
    height: 450px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

/* --- Display Section (Graph + Screen) --- */
.display-section {
    flex: 1.3;
    display: flex;
    background: #fff;
    border-bottom: 2px solid #f0f0f0;
}

#graph-area {
    flex: 1.6;
    background: #fafafa;
    border-right: 1px solid #eee;
    position: relative;
}

.text-screen {
    flex: 1;
    background: #f8faf8;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 1px solid #f0f0f0;
}

#input-line { 
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.3rem; 
    color: #2c3e50; 
    font-weight: bold;
    overflow-wrap: break-word;
    letter-spacing: 1px;
}

#output-line { 
    font-size: 1.6rem; 
    text-align: right; 
    color: #007bff; 
    font-weight: 700;
    transition: all 0.3s ease;
}

/* --- Controls Section (Keypad) --- */
.controls-section {
    flex: 1;
    padding: 12px;
    background: #fdfdfd;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    height: 100%;
}

/* --- Advanced Button Styling --- */
.btn {
    border: 1px solid #d1d1d1;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(to bottom, #ffffff, #f5f5f5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.9);
    color: #444;
    user-select: none;
}

/* Button Hover & Active States */
.btn:hover {
    border-color: #bbb;
    background: linear-gradient(to bottom, #fafafa, #e8e8e8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn:active {
    transform: translateY(1px) scale(0.97);
    background: #e0e0e0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* --- Specialized Button Themes --- */

/* Numbers */
.num {
    background: #ffffff;
    color: #333;
}

/* Operators (+, -, *, /) */
.op {
    background: linear-gradient(to bottom, #fff9f0, #fff3e0);
    color: #e67e22;
    border-color: #ffe0b2;
}
.op:hover { background: #fff3e0; }

/* Functions (sin, cos, log, ^) */
.func {
    background: linear-gradient(to bottom, #f0f7ff, #e3f2fd);
    color: #2980b9;
    border-color: #bbdefb;
}

/* GRAPH Button (Advanced Green) */
.graph-btn {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3) !important;
}
.graph-btn:hover {
    background: linear-gradient(135deg, #81c784 0%, #4caf50 100%) !important;
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4) !important;
}

/* AC Button (Danger Red) */
.ac-btn {
    background: linear-gradient(135deg, #ff8a80 0%, #e53935 100%) !important;
    color: white !important;
    border: none !important;
}

/* ENTER Button (Sophisticated Dark) */
.enter-btn {
    background: linear-gradient(135deg, #424242 0%, #212121 100%) !important;
    color: white !important;
    border: none !important;
    grid-column: span 1;
}

/* --- Scrollbar Styling (For long inputs) --- */
#input-line::-webkit-scrollbar {
    height: 4px;
}
#input-line::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}