/* GobSearch - Goblin/Fantasy Theme Styles */

/* ============ Fonts ============ */
@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Uncial+Antiqua&family=Roboto:wght@400;500;700&display=swap');

/* ============ CSS Variables ============ */
:root {
    --primary: #2d5a27;
    --primary-light: #3d7a37;
    --primary-dark: #1d3a17;
    --secondary: #8b4513;
    --secondary-light: #a0522d;
    --accent: #ffd700;
    --accent-glow: rgba(255, 215, 0, 0.3);
    --background: #1a1a1a;
    --background-light: #2a2a2a;
    --surface: #252525;
    --text: #f5e6c8;
    --text-muted: #a89a7c;
    --danger: #8b0000;
    --danger-light: #a52a2a;
    --success: #228b22;
    --border: #4a3c2a;
    --parchment: #f4e4bc;
    --parchment-dark: #d4c49c;
}

/* ============ Reset & Base ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at top, rgba(45, 90, 39, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(139, 69, 19, 0.1) 0%, transparent 50%);
    min-height: 100vh;
}

/* ============ Typography ============ */
h1, h2, h3, h4, h5, h6 {
    font-family: 'MedievalSharp', cursive;
    color: var(--accent);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.title-medieval {
    font-family: 'Uncial Antiqua', cursive;
}

/* ============ Layout ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============ Login Page ============ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background-light) 100%);
    border: 3px solid var(--secondary);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    box-shadow:
        0 0 30px rgba(139, 69, 19, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--primary));
    border-radius: 23px;
    z-index: -1;
    opacity: 0.5;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-logo .goblin-icon {
    font-size: 80px;
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px var(--accent-glow));
    animation: float 3s ease-in-out infinite;
}

.login-logo .goblin-logo {
    width: 120px;
    height: auto;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 15px var(--accent-glow));
    animation: float 3s ease-in-out infinite;
}

.goblin-logo-sm {
    width: 50px;
    height: auto;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-logo h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-align: center;
}

.login-logo .subtitle {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.login-logo img {
    display: block;
    margin: 0 auto;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text);
    border: 2px solid var(--primary-light);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(45, 90, 39, 0.4);
}

.btn-gold {
    background: linear-gradient(135deg, var(--accent) 0%, #b8860b 100%);
    color: var(--background);
    border: 2px solid var(--accent);
    text-shadow: none;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 30px var(--accent-glow);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    color: var(--text);
    border: 2px solid var(--secondary-light);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 69, 19, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    color: var(--text);
    border: 2px solid var(--danger-light);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 0, 0, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ============ Dashboard Header ============ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 30px;
}

.dashboard-header .logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.dashboard-header .logo:hover {
    opacity: 0.9;
}

.dashboard-header .logo .goblin-icon {
    font-size: 40px;
}

.dashboard-header .logo h1 {
    font-size: 1.8rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.user-info .avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ============ Cards ============ */
.card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background-light) 100%);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-parchment {
    background:
        linear-gradient(135deg, var(--parchment) 0%, var(--parchment-dark) 100%);
    color: var(--background);
    border: 3px solid var(--secondary);
    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.3),
        inset 0 0 30px rgba(139, 69, 19, 0.1);
}

.card-parchment h2,
.card-parchment h3,
.card-parchment h4 {
    color: var(--secondary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============ Stats Grid ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background-light) 100%);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'MedievalSharp', cursive;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============ Table ============ */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 2px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--primary-dark);
    color: var(--accent);
    font-family: 'MedievalSharp', cursive;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

th.sortable:hover {
    background: var(--primary);
}

.sort-icon {
    margin-left: 5px;
    font-size: 0.75rem;
    opacity: 0.8;
}

tr {
    background: var(--surface);
    transition: background 0.3s ease;
}

tr:hover {
    background: var(--background-light);
}

tr:nth-child(even) {
    background: var(--background);
}

tr:nth-child(even):hover {
    background: var(--background-light);
}

/* ============ Search & Filters ============ */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-box .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0.5;
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.pagination button {
    padding: 10px 15px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--background-light);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    color: var(--text-muted);
}

/* ============ Modal ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background-light) 100%);
    border: 3px solid var(--secondary);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 50px rgba(139, 69, 19, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.modal-title {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* ============ Alerts ============ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: rgba(139, 0, 0, 0.2);
    border: 2px solid var(--danger);
    color: #ff6b6b;
}

.alert-success {
    background: #1a3d1a;
    border: 2px solid var(--success);
    color: #6bcf6b;
}

.notification {
    background: var(--surface) !important;
}

.alert-info {
    background: rgba(45, 90, 39, 0.2);
    border: 2px solid var(--primary);
    color: var(--text);
}

/* ============ Loading Spinner ============ */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 10px;
}

/* ============ Tabs ============ */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.tab {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.tab:hover {
    color: var(--text);
    background: var(--surface);
}

.tab.active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--surface);
}

/* ============ Badge ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-gold {
    background: var(--accent);
    color: var(--background);
}

.badge-green {
    background: var(--primary);
    color: var(--text);
}

.badge-brown {
    background: var(--secondary);
    color: var(--text);
}

/* ============ Visits Map Placeholder ============ */
.visits-map {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.visits-map .map-icon {
    font-size: 100px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* ============ Action Buttons in Table ============ */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-btn {
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.action-btn:hover {
    background: var(--background-light);
    border-color: var(--accent);
}

.action-btn.delete:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ============ Import Section ============ */
.import-section {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
}

.import-section:hover {
    border-color: var(--accent);
}

.import-section .treasure-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.import-section input[type="file"] {
    display: none;
}

.import-section label {
    cursor: pointer;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal {
        margin: 10px;
        padding: 20px;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 25px;
    }

    .login-logo .goblin-icon {
        font-size: 60px;
    }

    .login-logo h1 {
        font-size: 2rem;
    }
}

/* ============ Deduplicate Modal ============ */
.dedupe-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.dedupe-counter {
    background: var(--primary);
    color: var(--text);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

.dedupe-ean {
    background: var(--secondary);
    color: var(--text);
    padding: 5px 15px;
    border-radius: 20px;
    font-family: monospace;
}

.dedupe-extra {
    background: var(--danger);
    color: var(--text);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.dedupe-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.dedupe-table th {
    background: var(--surface);
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    color: var(--accent);
}

.dedupe-table th:first-child {
    width: 120px;
}

.dedupe-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.dedupe-table .field-label {
    font-weight: bold;
    color: var(--text-muted);
    background: var(--surface);
}

.dedupe-table .field-value {
    background: var(--background-light);
    transition: all 0.2s ease;
}

.dedupe-table .field-value.selectable {
    cursor: pointer;
    position: relative;
}

.dedupe-table .field-value.selectable:hover {
    background: var(--primary-dark);
    outline: 2px solid var(--primary-light);
    outline-offset: -2px;
}

.dedupe-table .field-value.selected {
    background: var(--primary);
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    box-shadow: inset 0 0 15px var(--accent-glow);
}

.dedupe-table .field-value .empty-value {
    color: var(--text-muted);
    font-style: italic;
}

.dedupe-row.has-diff .field-label {
    color: var(--accent);
}

.dedupe-row.has-diff .field-value {
    position: relative;
}

@media (max-width: 600px) {
    .dedupe-table th:first-child,
    .dedupe-table td:first-child {
        width: 80px;
        font-size: 0.85rem;
    }

    .dedupe-table td {
        font-size: 0.9rem;
        padding: 8px;
    }

    .dedupe-header {
        gap: 10px;
    }

    .dedupe-counter,
    .dedupe-ean {
        padding: 4px 10px;
        font-size: 0.85rem;
    }
}

/* ============ Makina Mind Modal ============ */
.modal-logo {
    height: 64px;
    width: auto;
    margin-right: 15px;
    vertical-align: middle;
}

.btn-logo {
    height: 40px;
    width: auto;
    margin-left: 4px;
    vertical-align: middle;
}

.btn-makina {
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.lots-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lot-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.lot-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.lot-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lot-icon {
    font-size: 2rem;
}

.lot-details h4 {
    color: var(--text);
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.lot-details p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

.lot-actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.lot-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.lot-card.added {
    border-color: var(--success);
    background: rgba(34, 139, 34, 0.1);
}

.lot-card.added::after {
    content: '✓ Ajouté';
    color: var(--success);
    font-weight: bold;
    margin-left: 10px;
}

@media (max-width: 600px) {
    .lot-card {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .lot-info {
        flex-direction: column;
    }

    .lot-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ============ Logo Upload Page ============ */
.logo-upload-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 15px;
    text-align: center;
}

.logo-preview {
    width: 150px;
    height: 150px;
    margin: 20px auto;
    border: 2px dashed var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--background);
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-preview-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}
