/* ---------------------------
    Styles used in index.php
   --------------------------- */

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    min-height: 100vh;
    background-color: #fff;

    /* Bakgrunnsbilder for hjørner */
    background-image: url('/images/leftuppercorner.png'), url('/images/rightuppercorner.png'),  url('/images/lowerleftcorner.png'), url('/images/lowerrightcorner.png');
    background-repeat: no-repeat, no-repeat;
    background-position: top left, top right,  bottom left, bottom right;

    /* Dynamisk skalering: min 50px, max 25% av bredde, høyde 1/3 av viewport */
    background-size: 
        clamp(50px, 25vw, 33vh) auto, 
        clamp(50px, 25vw, 33vh) auto;
}
input[type="text"],
textarea {
    font-family: Arial, sans-serif;
    font-size: 14px;
    box-sizing: border-box;
	line-height: 1.4;
}
textarea {
    max-height: 300px;
    overflow-y: auto;
}
.container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}
.box {
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
}
h1.dashboard-heading {
    text-align: center;
    margin-top: 0;
}
/* Wrapper for user info Top line container */
.topbar {
    width: 100%;
    display: flex;
    justify-content: center;   
    padding: 15px 0;
    box-sizing: border-box;
}
/* Box around username + buttons */
.userinfo-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #ffffffaa; /* litt gjennomskinnelig hvit */
    font-size: 14px;
}
/* Username text */
.userinfo-box .username {
    font-weight: bold;
    font-size: 14px;
    padding-right: 4px;
}
/* Small buttons */
.btn-small {
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    background-color: #e8e8e8;
    color: #333;
    font-size: 12px;     
    border: 1px solid #ccc;
    transition: background 0.2s;
}
.btn-small:hover {
    background-color: #d0d0d0;
    border: 1px solid #ccc;
}
/* Logout button styling */
.btn-small.logout {
    background-color: #d4d4d4;
}
.btn-small.logout:hover {
    background-color: #bcbcbc;
    border: 1px solid #ccc;
}
.username {
    font-weight: bold;
}
/* ------------------------------
    Styles used in login.php
   ------------------------------ */

.login-box {
    width: 300px;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px #aaa;
}
input[type=text], input[type=password] {
    padding: 8px;
    margin-top: 6px;
    margin-bottom: 12px;
}
.error {
    color: red;
    margin-bottom: 10px;
}

/* ------------------------------
    Styles used in dashboard.php
   ------------------------------ */
   
.org-table-container,
.form-container {
    display: block; 
    justify-content: center;
    margin: 20px auto;
    width: 80%;
    max-width: 700px;
}
.table-scroll {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 6px;
}
table.simple-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
table.simple-table th,
table.simple-table td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}
table.simple-table th {
    background: #f5f5f5;
    text-align: left;
}
/* --- Overlay panels for Musikkmapper / Brukere --- */
.overlay-panel {
    display: none; 
    justify-content: center;
    margin: 20px auto;
    width: 80%;
    max-width: 700px;
}
.draggable-row {
    touch-action: none;   
	transition: background 0.2s;
}
.draggable-row.dragging {
    opacity: 0.4;
    background: #f0f0f0;
}
.overlay-panel {
    display: none;
    background: #ffffff;
    padding: 20px;
    border: 2px solid #888;
    border-radius: 10px;
    position: relative;
}
.overlay-close {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
}
.table-scroll.auto-scroll-up {
    box-shadow: inset 0 8px 8px -6px rgba(0,0,0,.2);
}
.table-scroll.auto-scroll-down {
    box-shadow: inset 0 -8px 8px -6px rgba(0,0,0,.2);
}

/* --- Popup (modal) for ny organisasjon / ny mappe / ny bruker --- */

.popup-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
}

.popup-box {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 350px;
    border: 2px solid #444;
    z-index: 100;
}

.popup-box h3 {
    margin-top: 0;
}

.popup-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px;
    width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.4);
    z-index: 9990;
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.dialog-design {
    background: white;
    padding: 20px;
    border-radius: 8px;
    min-width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: center;
}

.dialog-buttons {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
}   

/* ----------------------------------
    Styles used in organisations.php
   ---------------------------------- */

.drop-zone {
    border: 2px dashed #aaa;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    padding: 5px;
    transition: 0.2s;
}
.drop-zone.drag-over {
    border-color: #2980b9;
    background: #eef6ff;
}
.drop-zone.image-drop {
    width: 120px;
    height: 120px;
}
.drop-zone.image-drop img.img-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.img-preview {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;    /* holder proporsjonene uten å sprenge boksen */
}
.drop-zone.file-drop {
    min-width: 220px;
    height: auto;
    padding: 8px 10px;
    justify-content: flex-start;
}
.drop-zone.file-drop p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}
.oldfile-preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 0.9em;
    color: #333;
}
.file-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.file-open-icon {
    cursor: pointer;
    opacity: 0.7;
}

.file-open-icon:hover {
    opacity: 1;
}

.form-grid {
    display:grid;
    grid-template-columns: 150px 1fr;
    gap:10px 15px;
    align-items:center;
}

/* ---------------iconButtons - table + popup styling ---------------- */
.icon-stack {
    position: absolute;
    top: 8px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.icon-btn {
    width: 22px;
    height: 22px;
    cursor: pointer;
    color: #666;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    color: #000;
}
.icon-copy {}
.icon-delete {}
.icon-add {}
.icon-close {}
.form-container[data-mode="create"] .icon-copy,
.form-container[data-mode="create"] .icon-delete {
    display: none;
}
/* ---------------iconButtons - brukt i dashboard layover list og organisations.php - TODO: kan refaktoreres---------------- */
.btn-plus {
    float: right;
    font-size: 20px;
    cursor: pointer;
    margin-top: -28px;
}
.plus-btn {
    font-size: 22px;
    cursor: pointer;
    padding: 0 6px;
    color: #4679bd;
    float: right;
}
.plus-btn:hover {
    color: #2e5d98;
}
.plus-btn { float:right; cursor:pointer; font-size:20px; }

/* ---------------- knapper øverst til høyre over overlay-lister (søk + ny) ---------------- */
/* Én beholder som flyter til høyre (samme plassering som .btn-plus), knappene ligger side om side inni. */
.list-controls {
    float: right;
    margin-top: -28px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.list-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #333;
}
.list-btn:hover {
    color: #000;
}
.list-btn svg {
    display: block;
}
