/**
 * Tanoor Hadramout - Common Styles
 * الأنماط المشتركة بين جميع الصفحات
 */

/* ==========================================
   CSS Variables
   ========================================== */
:root {
    --th-primary: #D4AF37;
    --th-secondary: #8B0000;
    --th-dark: #1a1a2e;
    --th-light: #f5f5f5;
    --th-success: #4CAF50;
    --th-error: #f44336;
    --th-warning: #ff9800;
    --th-info: #2196F3;
    --th-border: #e0e0e0;
    --th-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    --th-radius: 12px;
    --th-radius-lg: 20px;
    --th-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   Typography
   ========================================== */
.th-heading {
    font-weight: 700;
    margin: 0 0 15px;
    color: var(--th-dark);
}

.th-text-primary { color: var(--th-primary); }
.th-text-secondary { color: var(--th-secondary); }
.th-text-success { color: var(--th-success); }
.th-text-error { color: var(--th-error); }

/* ==========================================
   Buttons
   ========================================== */
.th-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--th-radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--th-transition);
    text-decoration: none;
}

.th-btn:hover {
    transform: translateY(-2px);
}

.th-btn:active {
    transform: scale(0.98);
}

.th-btn-primary {
    background: linear-gradient(135deg, var(--th-secondary), #a00);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
}

.th-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.4);
}

.th-btn-secondary {
    background: var(--th-primary);
    color: var(--th-dark);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.th-btn-outline {
    background: transparent;
    border: 2px solid var(--th-border);
    color: var(--th-dark);
}

.th-btn-outline:hover {
    border-color: var(--th-primary);
    background: rgba(212, 175, 55, 0.1);
}

.th-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   Cards
   ========================================== */
.th-card {
    background: #fff;
    border-radius: var(--th-radius-lg);
    padding: 25px;
    box-shadow: var(--th-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--th-transition);
}

.th-card:hover {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.12);
}

.th-card-header {
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--th-light);
}

/* ==========================================
   Forms
   ========================================== */
.th-input,
.th-select,
.th-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--th-border);
    border-radius: var(--th-radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--th-transition);
    background: #fff;
}

.th-input:focus,
.th-select:focus,
.th-textarea:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.th-input.has-error {
    border-color: var(--th-error);
    animation: shake 0.5s;
}

/* ==========================================
   Badges
   ========================================== */
.th-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.th-badge-success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--th-success);
}

.th-badge-error {
    background: rgba(244, 67, 54, 0.15);
    color: var(--th-error);
}

.th-badge-warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--th-warning);
}

.th-badge-info {
    background: rgba(33, 150, 243, 0.15);
    color: var(--th-info);
}

/* ==========================================
   Alerts
   ========================================== */
.th-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 20px;
    border-radius: var(--th-radius);
    font-size: 14px;
}

.th-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.th-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.th-alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.th-alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ==========================================
   Loading States
   ========================================== */
.th-loading {
    position: relative;
    pointer-events: none;
}

.th-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: var(--th-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   Animations
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

.th-animate-fadeIn { animation: fadeIn 0.5s ease-out; }
.th-animate-fadeInUp { animation: fadeInUp 0.5s ease-out; }

/* ==========================================
   Utilities
   ========================================== */
.th-text-center { text-align: center; }
.th-text-right { text-align: right; }
.th-text-left { text-align: left; }

.th-flex { display: flex; }
.th-flex-center { display: flex; align-items: center; justify-content: center; }
.th-flex-between { display: flex; align-items: center; justify-content: space-between; }

.th-gap-sm { gap: 8px; }
.th-gap-md { gap: 15px; }
.th-gap-lg { gap: 25px; }

.th-mt-sm { margin-top: 8px; }
.th-mt-md { margin-top: 15px; }
.th-mt-lg { margin-top: 25px; }

.th-mb-sm { margin-bottom: 8px; }
.th-mb-md { margin-bottom: 15px; }
.th-mb-lg { margin-bottom: 25px; }

.th-hidden { display: none !important; }
.th-visible { display: block !important; }

/* ==========================================
   RTL Support
   ========================================== */
[dir="rtl"] .th-flex-between {
    flex-direction: row-reverse;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
    .th-card {
        padding: 20px;
    }
    
    .th-btn {
        width: 100%;
    }
    
    .th-hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .th-hide-desktop {
        display: none !important;
    }
}
