/* ===============================
   🔹 Base & Reset
   =============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    color: #212529;
}

/* ===============================
   🔹 App Structure
   =============================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ===============================
   🔹 Toolbar
   =============================== */
.toolbar {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.tool-group,
.control-group,
.action-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===============================
   🔹 Buttons
   =============================== */
.tool-btn,
.action-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover,
.action-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.tool-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.tool-btn.active:hover {
    background: #0056b3;
}

/* ===============================
   🔹 Color Picker
   =============================== */
#colorPicker {
    width: 30px;
    height: 30px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

/* ===============================
   🔹 Size Control
   =============================== */
.size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-control label {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

#sizeSlider {
    width: 100px;
}

#sizeDisplay {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
    min-width: 24px;
}

/* ===============================
   🔹 Canvas Container
   =============================== */
.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    overflow: hidden;
    background: #f5f5f5;
}

#whiteboard {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
    width: 100%;
    height: 100%;
    max-width: 95vw;
    max-height: 90vh;
}

/* ===============================
   🔹 Text Input for Board
   =============================== */
.whiteboard-text-input {
    position: absolute;
    min-width: 200px;
    min-height: 40px;
    border: 2px dashed #007bff;
    background: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-family: inherit;
    padding: 4px 6px;
    resize: both;
    z-index: 1000;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: border-style 0.2s ease;
}

.whiteboard-text-input:focus {
    border-style: solid;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

/* ===============================
   🔹 Responsive Layout
   =============================== */

/* Small phones (portrait) */
@media (max-width: 480px) {
    .toolbar {
        flex-direction: column;
        align-items: center;
        padding: 12px;
        gap: 12px;
    }

    .tool-btn,
    .action-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 15px;
        border-radius: 10px;
    }

    #colorPicker {
        width: 44px;
        height: 44px;
    }

    #sizeSlider {
        width: 80px;
    }

    .whiteboard-text-input {
        font-size: 14px;
        min-width: 100px;
    }
}

/* Tablets (portrait/landscape) */
@media (min-width: 481px) and (max-width: 1024px) {
    body {
        overflow: auto;
    }

    .toolbar {
        padding: 10px 20px;
        gap: 18px;
    }

    .tool-btn,
    .action-btn {
        min-width: 50px;
        min-height: 50px;
        font-size: 16px;
        padding: 10px;
    }

    #colorPicker {
        width: 50px;
        height: 50px;
    }

    #sizeSlider {
        width: 140px;
    }

    .canvas-container {
        padding: 12px;
    }

    #whiteboard {
        max-width: 95vw;
        max-height: 85vh;
    }
}

/* Laptops and Desktops */
@media (min-width: 1025px) and (max-width: 1600px) {
    .toolbar {
        padding: 10px 24px;
        justify-content: center;
    }

    .tool-btn,
    .action-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 14px;
    }

    #whiteboard {
        max-width: 90vw;
        max-height: 88vh;
    }
}

/* Large Screens / Smart TVs */
@media (min-width: 1601px) {
    body {
        font-size: 18px;
    }

    .toolbar {
        padding: 16px 40px;
        gap: 24px;
    }

    .tool-btn,
    .action-btn {
        min-width: 70px;
        min-height: 70px;
        font-size: 18px;
    }

    #whiteboard {
        max-width: 80vw;
        max-height: 80vh;
    }
}

/* Touch devices */
@media (pointer: coarse) {
    .tool-btn,
    .action-btn {
        min-width: 44px;
        min-height: 44px;
    }
    #colorPicker {
        width: 44px;
        height: 44px;
    }
}

/* ===============================
   🔹 Accessibility
   =============================== */
.tool-btn:focus,
.action-btn:focus,
#colorPicker:focus,
#sizeSlider:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ===============================
   🔹 Disabled States
   =============================== */
.tool-btn:disabled,
.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===============================
   🔹 Headings
   =============================== */
.h1-blue {
    color: #007bff;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    margin: 10px 0;
}
