:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: #f5f7ff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

main {
    flex: 1;
    padding: 0;
    margin: 0;
    width: 100%;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.container {
    display: flex;
    flex: 1;
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100vw; /* Full viewport width */
    max-width: 100%;
}

.control.sidebar {
    background: white;
    padding: 1rem;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    width: 250px;
    min-width: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.main-content {
    flex: 1;
    min-height: 100%;
    background: white;
    display: flex;
    overflow: hidden;
    width: calc(100vw - 250px); /* Full width minus sidebar */
}

#divCanvas {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: white;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.slider-container {
    margin-bottom: 2rem;
}

.slider-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    gap: 0.5rem;
}

.slider-value {
    font-weight: 600;
    color: var(--primary);
    min-width: 2rem;
    text-align: right;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none; /* Standard property */
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
}

.slider-value {
    font-weight: 600;
    color: var(--primary);
    min-width: 2.5rem;
    text-align: center;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    width: 100%;
}

.button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    text-align: left;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
    justify-content: flex-start;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button:active {
    transform: translateY(0);
}

.button i {
    margin-right: 0.5rem;
}

.button-primary { background-color: var(--primary); }
.button-secondary { background-color: var(--secondary); }
.button-accent { background-color: var(--accent); }
.button-success { background-color: var(--success); }
.button-warning { 
    background-color: #f8961e;
    background-image: linear-gradient(135deg, #f8961e, #f9c74f);
}
.button-danger { 
    background-color: #0d7a8c;
    background-image: linear-gradient(135deg, #0d7a8c, #14b8a6);
}

.button-danger span[role="img"] {
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2em 0.3em;
    border-radius: 0.3em;
    margin-right: 0.2em;
}
.button-dark { background-color: var(--dark); }

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 1rem 1.5rem 0 0;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto;
}

.button-clear {
    background-color: var(--gray);
}

.button-stop {
    background-color: #0d7a8c;
    background-image: linear-gradient(135deg, #0d7a8c, #14b8a6);
}

.button-stop span[role="img"] {
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2em 0.3em;
    border-radius: 0.3em;
    margin-right: 0.2em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    
    .control.sidebar {
        width: 100%;
        max-height: 200px;
        overflow-x: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.5rem;
    }
    
    .button-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .button {
        flex: 1 0 calc(50% - 0.5rem);
        min-width: 120px;
        justify-content: center;
    }
}
