:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --highlight-color: #4fc3f7;
    --danger-color: #e63946;
    --success-color: #2a9d8f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: var(--dark-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

button:hover {
    background-color: #0d4b6e;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.toolbar {
    width: 250px;
    background-color: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
}

.tool-section {
    margin-bottom: 25px;
}

.tool-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.tool-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.tool-btn {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    color: var(--dark-color);
    border: 1px solid #ddd;
    font-size: 1.2rem;
    padding: 0;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background-color: #e9ecef;
}

.tool-btn.active {
    background-color: var(--highlight-color);
    color: white;
    border-color: var(--highlight-color);
}

.color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--dark-color);
    transform: scale(1.1);
}

#custom-color {
    width: 100%;
    height: 40px;
    border: none;
    cursor: pointer;
    background: transparent;
}

input[type="range"] {
    width: 100%;
    margin: 10px 0;
    accent-color: var(--primary-color);
}

#text-options input, #text-options select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.whiteboard-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#whiteboard {
    background-color: white;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
    height: 100%;
}

.status-bar {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 20px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.modal-content button {
    width: 100%;
    margin-bottom: 10px;
}

#save-png {
    background-color: var(--success-color);
}

#save-jpeg {
    background-color: #4CAF50;
}

@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        width: 100%;
        border-radius: 0;
    }

    .toolbar {
        width: 200px;
        padding: 10px;
    }

    .tool-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .color-options {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 576px) {
    .main-content {
        flex-direction: column;
    }

    .toolbar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 10px;
    }

    .tool-section {
        margin-bottom: 0;
        flex: 1;
        min-width: 120px;
    }

    .tool-options {
        grid-template-columns: repeat(3, 1fr);
    }

    .app-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    button {
        flex: 1;
        justify-content: center;
    }
}