/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
}

/* Main Container */
main {
    height: calc(100vh - 2rem);
    display: grid;
    grid-template-rows: auto 1fr auto;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header/Toolbar */
#head {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    grid-row: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Button Base Styles */
button {
    font-family: inherit;
    font-size: 0.875rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    outline: none;
    position: relative;
    overflow: hidden;
}

button:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Tool Buttons (with text and icons) */
.tool-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #495057;
    border: 1px solid #dee2e6;
    min-width: auto;
}

.tool-btn:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.tool-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.tool-btn.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
}

.tool-btn i {
    font-size: 1rem;
}

/* Action Buttons (icon only) */
.action-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #6c757d;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pushed-button, .action-btn:hover {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border-color: #6c757d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-btn:disabled:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #6c757d;
    border-color: #dee2e6;
}

/* Delete Button */
.delete-btn:hover {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Save Button */
.save-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: 1px solid #28a745;
    font-weight: 600;
    margin-left: auto;
}

.save-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.save-btn i {
    font-size: 1rem;
}

/* Separator */
.separator {
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #dee2e6, transparent);
    margin: 0 0.5rem;
}

/* Body/Canvas Area */
#body {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    grid-row: 2;
    background: #f8f9fa;
}

#body > div {
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    position: absolute;
}

/* Footer/Property Panels */
#foot {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    overflow-x: auto;
    grid-row: 3;
    min-height: 60px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* Property Panel Styles */
#foot > div {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#foot label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #495057;
}

#foot input[type="color"] {
    width: 40px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}

#foot input[type="color"]:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

/* Font Size Buttons */
.decreaseFontSize, .increaseFontSize {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    color: #495057;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.decreaseFontSize:hover, .increaseFontSize:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
}

/* Image Gallery */
ul.images {
    display: flex;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

ul.images > li {
    margin: 0;
    padding: 0;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    background: #ffffff;
    display: block;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

ul.images > li:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

ul.images > li > img {
    width: auto;
    height: 5rem;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

ul.images > li:hover > img {
    transform: scale(1.05);
}

/* Scrollbar Styling */
ul.images::-webkit-scrollbar {
    height: 6px;
}

ul.images::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

ul.images::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 3px;
}

ul.images::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    #head {
        padding: 0.75rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .tool-btn span {
        display: none;
    }

    .tool-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
    }

    .save-btn span {
        display: none;
    }

    .save-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
    }

    .separator {
        display: none;
    }

    #foot {
        padding: 0.75rem;
    }
}
