/* =========================================================
   SETTINGS / LOGIN
   settings.css
   Benötigt zusätzlich: comm.css
   ========================================================= */

/* =========================================================
   MELDUNGEN
   ========================================================= */
.message {
    margin-bottom: 15px;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
}

.message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* =========================================================
   EDITOR
   ========================================================= */
.editor-card {
    overflow: hidden;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-light);
}

.editor-header h1 {
    margin: 0;
    font-size: 18px;
}

.editor-header p {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--color-text-muted);
}

.article-count {
    flex-shrink: 0;
    padding: 6px 9px;
    border-radius: 7px;
    background: var(--gray-light);
    color: #444444;
    font-size: 11px;
    font-weight: 700;
}

/* =========================================================
   PRODUKTLISTE
   ========================================================= */
.product-list {
    overflow: hidden;
    width: 100%;
    background: var(--card-bg);
}

/* =========================================================
   PRODUKTZEILE
   ========================================================= */
.product-row {
    position: relative;
    display: grid;
    grid-template-columns:
        30px
        minmax(0, 1fr)
        135px
        34px;
    align-items: end;
    gap: 10px;
    padding: 3px 12px;
    background: var(--color-white);
    border-bottom:
        1px solid var(--border-light);
    transition:
        transform 0.15s ease,
        opacity 0.15s ease,
        background-color 0.15s ease,
        box-shadow 0.15s ease;
}

.product-row:last-child {
    border-bottom: 0;
}

/* =========================================================
   DRAG & DROP
   ========================================================= */
.drag-handle {
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888888;
    font-size: 20px;
    font-weight: 700;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    border-radius: var(--radius-medium);
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.drag-handle:hover {
    background: var(--gray-light);
    color: var(--color-dark);
}

.drag-handle:active {
    cursor: grabbing;
}

/* =========================================================
   DESKTOP DRAGGING
   ========================================================= */
.product-row.dragging {
    opacity: 0.45;
}

.product-row.drag-over {
    background: var(--gray-light);
}

/* =========================================================
   MOBILE DRAGGING
   ========================================================= */
.product-row.touch-dragging {
    opacity: 0.85;
    transform: scale(1.015);
    background: var(--gray-light);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

/* =========================================================
   INPUTS
   ========================================================= */
.product-input,
.price-input {
    min-width: 0;
}

.product-input input,
.price-input input {
    width: 100%;
    height: 34px;
    padding: 6px 8px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-small);
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 12px;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.2s ease,
        color 0.2s ease;
}

.product-input input:focus,
.price-input input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.07);
}

/* =========================================================
   PREISFELD
   ========================================================= */
.price-field {
    display: flex;
    align-items: center;
    gap: 5px;
}

.price-field input {
    text-align: right;
}

.price-field span {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-dark);
}

/* =========================================================
   LÖSCHEN
   ========================================================= */
.delete-button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border:
        1px solid #e11d48;
    border-radius: var(--radius-medium);
    background: #f43f5e;
    color: var(--color-white);
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease,
        box-shadow 0.15s ease;
}

.delete-button:hover {
    background: #e11d48;
    border-color: #be123c;
    box-shadow: 0 2px 7px rgba(225, 29, 72, 0.30);
}

.delete-button:active {
    background: #be123c;
    border-color: #be123c;
    transform: scale(0.92);
}

/* =========================================================
   NEUER ARTIKEL
   ========================================================= */
.add-section {
    background: #fafafa;
    border-top: 1px solid var(--border-light);
}

.new-product-row {
    border-bottom: 1px solid #dddddd !important;
}

/* =========================================================
   HINZUFÜGEN
   ========================================================= */
.add-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 13px;
    margin: 8px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-medium);
    background: var(--gray-light);
    color: var(--color-dark);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        transform 0.1s ease;
}

.add-button:hover {
    background: #dddddd;
}

.add-button:active {
    transform: scale(0.96);
}

/* =========================================================
   SPEICHERN
   ========================================================= */
.save-area {
    display: flex;
    justify-content: flex-end;
    padding: 15px 18px;
    border-top: 1px solid var(--border-light);
}

.save-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 17px;
    border: 1px solid var(--button-dark);
    border-radius: 9px;
    background: var(--button-dark);
    color: var(--color-white);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition:
        background-color 0.15s ease,
        transform 0.1s ease;
}

.save-button:hover {
    background: var(--button-dark-hover);
}

.save-button:active {
    transform: scale(0.97);
}

/* =========================================================
   ZURÜCK
   ========================================================= */
.back-button {
    display: block;
    width: fit-content;
    margin: 15px auto 0;
    padding: 9px 14px;
    border: 1px solid var(--button-blue);
    border-radius: 10px;
    background: var(--button-blue);
    color: var(--color-white);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.1s ease;
}

.back-button:hover {
    background: var(--button-blue-hover);
    border-color: var(--button-blue-hover);
    box-shadow:
        0 4px 10px rgba(37, 99, 235, 0.35);
}

.back-button:active {
    background: var(--button-blue-active);
    border-color: var(--button-blue-active);
    transform: scale(0.96);
}

/* =========================================================
   LOGIN
   ========================================================= */
.login-card {
    width: 100%;
    max-width: 400px;
    margin: 80px auto 0;
    padding: 28px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.10);
    text-align: center;
}

.login-icon {
    margin-bottom: 10px;
    font-size: 38px;
}

.login-card h1 {
    margin: 0 0 5px;
    font-size: 22px;
}

.login-subtitle {
    margin: 0 0 22px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.login-card form {
    text-align: left;
}

.login-card label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 700;
}

.login-card input[type="password"] {
    width: 100%;
    height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-medium);
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 14px;
    outline: none;
}

.login-card input[type="password"]:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07);
}

/* =========================================================
   PRIMARY BUTTON
   ========================================================= */
.primary-button {
    width: 100%;
    margin-top: 12px;
    padding: 11px;
    border: 1px solid var(--button-dark);
    border-radius: var(--radius-medium);
    background: var(--button-dark);
    color: var(--color-white);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        transform 0.1s ease;
}

.primary-button:hover {
    background: var(--button-dark-hover);
}

.primary-button:active {
    transform: scale(0.98);
}

/* =========================================================
   LOGIN FEHLER
   ========================================================= */
.login-error {
    margin-bottom: 15px;
    padding: 9px 10px;
    border: 1px solid #aaaaaa;
    border-radius: 7px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 12px;
    font-weight: 700;
}

/* =========================================================
   DARKMODE
   ========================================================= */

/* INFO */
html.dark .info-box {
    background: var(--card-bg);
    color: #bbbbbb;
    border-color: #333333;
}

/* EDITOR */
html.dark .editor-header {
    border-color: var(--border-light);
}

html.dark .article-count {
    background: var(--gray-light);
    color: #dddddd;
}

/* ARTIKEL */
html.dark .product-row{
    background: var(--card-bg);
    border-color: var(--border-light);
}

html.dark .product-row.dragging {
    background: #292d35;
}

html.dark .product-row.drag-over,
html.dark .product-row.touch-dragging {
    background: #292e36;
}

/* DRAG-GRIFF */
html.dark .drag-handle {
    color: #aaaaaa;
    background: #242830;
}

html.dark .drag-handle:hover {
    color: var(--color-white);
    background: #30353e;
}

html.dark .product-row.touch-dragging {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

/* INPUTS */
html.dark .product-input input,
html.dark .price-input input,
html.dark .login-card input[type="password"] {
    background: var(--input-bg);
    color: var(--input-text);
    border-color: var(--input-border);
}

html.dark .product-input input:focus,
html.dark .price-input input:focus,
html.dark .login-card input[type="password"]:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

html.dark .price-field span {
    color: #aaaaaa;
}

/* LÖSCHEN */
html.dark .delete-button {
    background: #f43f5e;
    color: var(--color-white);
    border-color: #fb7185;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

html.dark .delete-button:hover {
    background: #fb7185;
    border-color: #fda4af;
    box-shadow: 0 3px 10px rgba(244, 63, 94, 0.35);
}

html.dark .delete-button:active {
    background: #e11d48;
    border-color: #e11d48;
}

/* NEUER ARTIKEL */
html.dark .add-section {
    background: #15171c;
    border-color: var(--border-light);
}

html.dark .new-product-row{
    border-color: var(--border-light) !Important;
}

html.dark .add-button {
    background: var(--gray-light);
    color: #eeeeee;
    border-color: #555555;
}

html.dark .add-button:hover {
    background: #40444d;
}

/* SPEICHERN */
html.dark .save-area {
    border-color: var(--border-light);
}

html.dark .save-button,
html.dark .primary-button {
    background: var(--color-white);
    color: var(--color-black);
    border-color: var(--color-white);
}

html.dark .save-button:hover,
html.dark .primary-button:hover {
    background: #dddddd;
}

/* ZURÜCK */
html.dark .back-button {
    background: #3b82f6;
    color: var(--color-white);
    border-color: #3b82f6;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.30);
}

html.dark .back-button:hover {
    background: var(--button-blue);
    border-color: var(--button-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.40);
}

html.dark .back-button:active {
    background: var(--button-blue-hover);
    border-color: var(--button-blue-hover);
}

/* MELDUNGEN */
html.dark .message.success {
    background: #143d25;
    color: #86efac;
    border-color: #226b3d;
}

html.dark .message.error,
html.dark .login-error {
    background: #3f1d1d;
    color: #fca5a5;
    border-color: #6b3030;
}

/* LOGIN */
html.dark .login-card {
    background: var(--card-bg);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.45);
}

html.dark .login-subtitle {
    color: var(--color-text-light);
}

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 600px) {
    /* PRODUKTLISTE */
    .product-row {
        grid-template-columns:
            32px
            minmax(0, 1fr)
            82px
            30px
            auto;
        gap: 6px;
        padding: 6px 8px;
    }

    .drag-handle {
        font-size: 16px;
    }

    /* INPUTS */
    .product-input input,
    .price-input input {
        height: 32px;
        padding: 5px 6px;
        font-size: 11px;
    }

    /* PREIS */
    .price-field {
        gap: 3px;
    }

    .price-field span {
        font-size: 10px;
    }

    /* LÖSCHEN */
    .delete-button {
        width: 30px;
        height: 30px;
    }

    /* SPEICHERN */
    .save-area {
        padding: 13px 10px;
    }

    .save-button {
        width: 100%;
    }

    /* LOGIN */
    .login-card {
        margin-top: 40px;
        padding: 24px 20px;
    }
}