/*
 * Tiedosto: admin/assets/css/admin-style.css
 * Versio: 2.0 (Restored Code 2 Logic)
 */

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --sidebar-width: 250px;
    --header-height: 60px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f4f6f9;
    height: 100vh;
    overflow: hidden;
}

a { text-decoration: none; color: var(--primary-color); }
ul { list-style: none; }

/* Komponentit: Napit */
.btn {
    display: inline-block; padding: 8px 16px;
    font-size: 0.9rem; font-weight: 500;
    border-radius: 4px; cursor: pointer;
    transition: all 0.2s; border: 1px solid transparent; text-align: center;
}
.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: var(--primary-dark); }
.btn-primary:disabled { background-color: #ccc; cursor: not-allowed; }

.btn-secondary { background-color: var(--secondary-color); color: #fff; }
.btn-secondary:hover { background-color: #5a6268; }

.btn-danger { background-color: var(--danger-color); color: #fff; }
.btn-danger:hover { background-color: #bd2130; }

.btn-text { background: none; color: var(--secondary-color); }
.btn-text:hover { color: var(--dark-color); text-decoration: underline; }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* Modaalit */
.modal {
    display: none; position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%; overflow: auto;
    background-color: rgba(0,0,0,0.5);
    justify-content: center; align-items: center;
}
.modal-content {
    background-color: #fff; margin: 5% auto; padding: 30px;
    border-radius: 8px; width: 100%; max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); position: relative;
}
.close { position: absolute; right: 20px; top: 15px; font-size: 24px; cursor: pointer; color: #aaa; }
.close:hover { color: #333; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--dark-color); }
.form-control, input[type="text"], input[type="date"], input[type="file"], textarea {
    width: 100%; padding: 10px;
    border: 1px solid var(--border-color); border-radius: 4px;
    font-size: 1rem; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0,123,255,0.1); }

/* Editorin tyylit */
.editor-container {
    display: flex;
    width: 100%;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* Vasen */
.sidebar-pages {
    width: 220px;
    min-width: 220px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 15px;
    height: 100%;
    flex-shrink: 0;
}
.page-thumb {
    margin-bottom: 15px; cursor: pointer; border: 2px solid transparent;
    text-align: center; position: relative; border-radius: 4px; overflow: hidden;
    transition: all 0.2s;
}
.page-thumb.active { border-color: var(--primary-color); background: #e7f1ff; box-shadow: 0 0 0 2px rgba(0,123,255,0.2); }
.page-thumb img { width: 100%; display: block; background: #fff; min-height: 100px; object-fit: contain; }

/* Keskiosa */
.workspace {
    flex: 1;
    background: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden; 
    padding: 20px;
    height: 100%;
    width: 100%;
}

.canvas-wrapper {
    position: relative;
    background: white;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    flex-shrink: 0;
    /* JS asettaa width/height, ei CSS */
}

/* Kuva pakotetaan pysymään laatikon sisällä */
.canvas-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Oikea */
.toolbar {
    width: 320px;
    min-width: 320px;
    background: white;
    border-left: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
    flex-shrink: 0;
}
.tool-section { margin-bottom: 25px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.tool-section:last-child { border-bottom: none; }
.tool-section h3 { font-size: 12px; text-transform: uppercase; color: #999; margin-bottom: 15px; letter-spacing: 1px; font-weight: 700; }

.tool-btn {
    display: flex; align-items: center; width: 100%; padding: 12px; margin-bottom: 8px;
    text-align: left; background: #fff; border: 1px solid var(--border-color);
    border-radius: 4px; cursor: pointer; transition: all 0.2s; color: #333;
}
.tool-btn i { width: 30px; font-size: 16px; color: #666; text-align: center; }
.tool-btn:hover { background: #f8f9fa; border-color: #bbb; transform: translateX(2px); }

.properties-panel { margin-top: 10px; background: #f8f9fa; padding: 15px; border-radius: 6px; border: 1px solid #eee; display: none; }
.properties-panel.active { display: block; animation: slideIn 0.3s; }

/* Editorin Hotspotit */
.hotspot { position: absolute; border: 2px dashed var(--primary-color); background: rgba(0, 123, 255, 0.2); cursor: move; }
.hotspot.selected { border: 2px solid var(--warning-color); background: rgba(255, 193, 7, 0.3); z-index: 10; }
.hotspot:hover { background: rgba(0, 123, 255, 0.4); }
.hotspot .resize-handle {
    width: 12px; height: 12px; background: var(--warning-color);
    position: absolute; bottom: -6px; right: -6px;
    cursor: se-resize; border-radius: 50%; border: 1px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.hotspot .type-icon {
    position: absolute; top: -12px; left: -12px;
    color: white; background: var(--primary-color);
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.page-size-selector {
    margin-right: 15px; padding: 5px 10px; border-radius: 4px;
    border: 1px solid #ddd; background: #fff; color: #333; font-size: 0.9rem;
}

@keyframes slideIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }