/* Modern AppShop Styles - Redesigned */
:root {
    --primary-color: #14b8a6; /* teal-500 */
    --primary-dark: #0d9488; /* teal-600 */
    --primary-light: #2dd4bf; /* teal-400 */
    --secondary-color: #f59e0b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

/* Header */
header {
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

header .logo {
    display: flex;
    align-items: center;
    padding: 0 30px;
    height: 100%;
    gap: 15px;
}

header .logo img {
    cursor: pointer;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

header .logo img:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

header .logo a {
    font-size: 1.75em;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header .logo a span {
    font-weight: 300;
    opacity: 0.9;
}

/* Main Layout */
main {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

nav ul {
    list-style: none;
    padding: 20px 0;
}

nav .section-header {
    color: var(--text-secondary);
    font-weight: 700;
    padding: 20px 25px 12px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

nav ul li a {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.95em;
}

nav ul li a:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    padding-left: 30px;
    color: var(--primary-color);
    border-left-color: var(--primary-light);
}

nav ul li a.selected {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding-left: 25px;
    border-left-color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

/* Content */
.content {
    flex: 1;
    padding: 40px;
    margin-left: 0;
    transition: margin-left 0.3s ease;
    background: transparent;
}

.content h1 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 2.25em;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.05em;
}

/* Box Component */
.box {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.box:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.box-top {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 20px 30px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.box-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.box-top h4 {
    margin: 0;
    font-size: 1.15em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.box-panel {
    padding: 30px;
    background: var(--bg-primary);
}

/* Forms */
.search-form,
.saisir-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1em;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--primary-light);
}

.btn-primary,
.btn-small {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.2s ease;
    align-self: flex-start;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.btn-small::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.btn-small:hover::before {
    width: 300px;
    height: 300px;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9em;
}

.btn-primary:hover,
.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active,
.btn-small:active {
    transform: translateY(0);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    transition: background-color 0.2s;
}

table tbody tr {
    transition: all 0.2s ease;
}

table tbody tr:nth-child(even) td {
    background-color: var(--bg-secondary);
}

table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

table tbody tr:hover td {
    background-color: transparent;
}

table img {
    max-width: 75px;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

table img:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* Statistics */
.statistics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.stat-item {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8em;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: calc(100vh - 70px);
        z-index: 999;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .content {
        margin-left: 0 !important;
        padding: 20px;
    }

    .content h1 {
        font-size: 1.75em;
    }

    .statistics {
        grid-template-columns: 1fr;
    }
}

/* Loading states */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Error messages */
.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--error-color);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    border-left: 4px solid var(--error-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.error::before {
    content: '⚠';
    font-size: 1.5em;
}

/* Success messages */
.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--success-color);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    border-left: 4px solid var(--success-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.success::before {
    content: '✓';
    font-size: 1.5em;
    font-weight: bold;
}

/* Additional modern touches */
.box-panel > *:first-child {
    margin-top: 0;
}

.box-panel > *:last-child {
    margin-bottom: 0;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.sidebar::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
