/**
 * Cosmetic Catalog - Main Stylesheet with Inline Editing
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
}

.logo a {
    color: white;
    text-decoration: none;
}

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

.nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

.user-info {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

/* Main Content */
.main-content {
    padding: 30px 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #444;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    height: 44px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-outline {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table a {
    color: #667eea;
    text-decoration: none;
}

.table a:hover {
    text-decoration: underline;
}

/* Search and Filters */
.search-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: end;
}

.search-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
}

.auth-container .card {
    padding: 40px;
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    color: #444;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Product/Provider Detail */
.product-header {
    margin-bottom: 30px;
}

.product-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #444;
}

.product-brand {
    color: #667eea;
    font-size: 18px;
    font-weight: 500;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 25px 0 15px 0;
    color: #555;
    border-left: 4px solid #667eea;
    padding-left: 12px;
}

/* Inline Editing Styles */
.editable-section {
    position: relative;
}

.editable-display {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.editable-display:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.editable-form {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 2px solid #667eea;
}

.editable-form.active {
    display: block;
}

.editable-display.hidden {
    display: none;
}

.edit-btn {
    float: right;
    padding: 4px 12px;
    font-size: 12px;
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Admin badge */
.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #17a2b8;
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.copy-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #6c757d;
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

/* Composition Table */
.composition-table {
    margin-top: 15px;
}

.ingredient-list {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    font-style: italic;
    color: #666;
}

/* Comments */
.comment-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-source {
    font-weight: 500;
    color: #667eea;
}

.comment-date {
    color: #888;
    font-size: 14px;
}

.comment-rating {
    color: #ffc107;
    font-weight: bold;
}

.comment-text {
    color: #555;
}

/* Websites List */
.website-list {
    list-style: none;
}

.website-list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.website-list li:last-child {
    border-bottom: none;
}

.website-list a {
    color: #667eea;
    text-decoration: none;
}

.website-list a:hover {
    text-decoration: underline;
}

/* Provider Info */
.provider-info {
    margin-bottom: 30px;
}

.provider-info p {
    margin-bottom: 8px;
}

.provider-info strong {
    color: #555;
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.grid-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.grid-item h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #444;
}

.grid-item p {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #888;
    font-size: 14px;
    margin-top: 5px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ddd;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .search-row {
        flex-direction: column;
    }
    
    .search-row .form-group {
        width: 100%;
    }
    
    .table-container {
        font-size: 14px;
    }
    
    .actions {
        flex-wrap: wrap;
    }
    
    .edit-actions {
        flex-direction: column;
    }
}

/* Utility Classes */
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.float-right { float: right; }
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
