:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --accent: #ffd700;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: -2;
}

/* Background Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -10%;
    right: -10%;
    animation: move 20s infinite alternate;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: #7c3aed;
    bottom: -5%;
    left: -5%;
    animation: move 25s infinite alternate-reverse;
}

@keyframes move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(100px, 50px);
    }
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--accent);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
}

.title-group h1 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(to left, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.3rem;
}

.contact-info {
    background: var(--glass-bg);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-info:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.calculator-card {
    padding: 2.5rem;
}

.calculator-card h2 {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
}

.section-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.triangles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.triangle-form {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.triangle-form h3 {
    margin-bottom: 1.5rem;
    color: var(--accent);
    font-size: 1.2rem;
}

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

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.result-badge {
    margin-top: 1rem;
    padding: 0.6rem;
    background: rgba(26, 115, 232, 0.1);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    border: 1px dashed var(--primary);
}

.total-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.primary-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 115, 232, 0.4);
}

.total-result {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.total-result strong {
    font-size: 3.5rem;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.unit {
    color: var(--text-muted);
    font-size: 1rem;
}

.sketch-card {
    padding: 1.5rem;
    text-align: center;
}

.sketch-card canvas {
    width: 100%;
    height: 250px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin: 1rem 0;
    border: 1px solid var(--glass-border);
}

.sketch-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.history-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.history-list {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.history-item .date {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.3rem;
}

.history-item .val {
    font-weight: 700;
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2rem;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 1rem;
    font-size: 0.9rem;
}

.text-btn:hover {
    color: #ef4444;
}

footer {
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.designer-credit {
    font-size: 0.85rem;
    opacity: 0.8;
}

.designer-credit a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-right: 5px;
}

.designer-credit a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .app-container {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        text-align: center;
        margin-bottom: 2rem;
        gap: 1.2rem;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .title-group h1 {
        font-size: 1.3rem;
        line-height: 1.4;
        max-width: 250px;
        margin: 0 auto;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .triangles-grid {
        grid-template-columns: 1fr;
    }

    .calculator-card {
        padding: 1.2rem;
    }

    .total-result strong {
        font-size: 2.8rem;
    }

    .contact-info {
        width: auto;
        min-width: 180px;
        display: inline-flex;
        justify-content: center;
        margin: 0 auto;
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
    }
}
