/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f5f7f9;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

h1 {
    color: #2e7d32;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

header p {
    color: #666;
}

/* Tab navigation */
.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tab-button {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button.active {
    background-color: #4caf50;
    color: white;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Form styles */
.form {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #444;
}

input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: #4caf50;
}

/* Buttons */
button {
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-calculate {
    width: 100%;
    padding: 1rem;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
}

.btn-calculate:hover {
    background-color: #3d8b40;
}

.btn-save {
    width: 100%;
    padding: 0.8rem;
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 1rem;
}

.btn-save:hover {
    background-color: #0b7dda;
}

.btn-clear {
    padding: 0.5rem 1rem;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
}

.btn-clear:hover {
    background-color: #d32f2f;
}

.btn-delete {
    padding: 0.4rem 0.8rem;
    background-color: #ffebee;
    color: #f44336;
    border: 1px solid #f44336;
    border-radius: 6px;
    font-size: 0.8rem;
}

.btn-delete:hover {
    background-color: #f44336;
    color: white;
}

/* Results section */
.results {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.results h2 {
    margin-bottom: 1.2rem;
    color: #2e7d32;
    text-align: center;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.results-focus {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.result-card.focus {
    background-color: #fffde7;
    border: 1px solid #ffe082;
}

.result-card {
    padding: 1rem;
    border-radius: 8px;
    background-color: #f9f9f9;
    text-align: center;
}

.result-card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.result-card p {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2e7d32;
}
.result-card p.text-blue { color: #2196f3; }
.result-card p.text-yellow { color: #fbc02d; }
.result-card p.text-green { color: #2e7d32; }

/* History section */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding: 0 0.5rem;
}

.history-list {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.history-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
}

.history-item:last-child {
    border-bottom: none;
}
.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}
.history-group {
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 0.8rem;
}

.history-group-title {
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: #555;
}

.history-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem 1rem;
    font-size: 0.9rem;
    color: #444;
}
.history-details .text-blue { color: #2196f3; }
.history-details .text-green { color: #2e7d32; }
.history-details .text-yellow { color: #fbc02d; }

.history-info {
    flex: 1;
}

.history-name {
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.history-date {
    font-size: 0.8rem;
    color: #888;
}

.history-value {
    font-weight: 600;
    color: #2e7d32;
}

/* Snackbar for notifications */
.snackbar {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 1rem;
    position: fixed;
    z-index: 1;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.snackbar.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* Login Overlay - Redesigned for better UX */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 2.5rem 2rem;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-icon {
    width: 80px;
    height: 80px;
    background-color: #4caf50;
    color: white;
    border-radius: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3);
}

.login-icon svg {
    width: 40px;
    height: 40px;
}

.login-card h2 {
    color: #2e7d32;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-card p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}

/* PIN Display - Dots */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.pin-digit {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background-color: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-digit.filled {
    background-color: #4caf50;
    border-color: #4caf50;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
}

.pin-digit.error {
    background-color: #f44336;
    border-color: #f44336;
    animation: shake 0.4s ease;
}

/* Numpad Grid */
.pin-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    max-width: 280px;
    margin: 0 auto;
}

.num-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: #fff;
    font-size: 1.6rem;
    font-weight: 500;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.num-btn:active {
    background-color: #4caf50;
    color: white;
    transform: scale(0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.num-btn.btn-action {
    background-color: #f5f5f5;
    font-size: 1.2rem;
    color: #666;
}

.num-btn.btn-action:active {
    background-color: #e0e0e0;
}

#pin-backspace {
    color: #f44336;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* Header Content with Logout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 0 1rem;
}

.btn-logout {
    padding: 0.6rem 1.2rem;
    background-color: #fff1f0;
    color: #f44336;
    border: 1px solid #ffccc7;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-logout:hover {
    background-color: #f44336;
    color: white;
    border-color: #f44336;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .num-btn {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }
    
    .pin-numpad {
        gap: 0.8rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 900px;
    }
    
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .results-focus {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .input-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: 1rem;
    }
    
    label {
        margin-bottom: 0;
    }
}