/**
 * Stylesheet cho Hệ Thống Tính Toán Cửa Gió
 */

/* Reset và thiết lập cơ bản */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--dark-color);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    color: white;
    margin-bottom: 30px;
    padding: 30px 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content > div:first-child {
    text-align: left;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Main Content */
.main-content {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 25px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2,
.card-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 30px 25px;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

select.form-control {
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, var(--primary-color) 100%);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 25px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    padding: 15px;
    background: var(--light-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.info-label {
    display: block;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-color);
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.table thead {
    background: var(--light-color);
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--light-color);
}

.table-hover tbody tr {
    transition: background 0.2s ease;
}

.text-right {
    text-align: right;
}

.text-success {
    color: var(--success-color);
    font-weight: 600;
}

.text-danger {
    color: var(--danger-color);
    font-weight: 600;
}

.subtotal td {
    background: #fef3c7;
    font-weight: 600;
}

.total td {
    background: #dbeafe;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Price Grid */
.price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.price-item {
    text-align: center;
    padding: 25px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow: var(--shadow);
}

.price-label {
    font-size: 0.95rem;
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 10px;
}

.price-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
}

.price-value.cost {
    color: var(--danger-color);
}

.price-value.selling {
    color: var(--primary-color);
}

.price-value.profit.positive {
    color: var(--success-color);
}

.price-value.profit.negative {
    color: var(--danger-color);
}

.price-value.margin.positive {
    color: var(--success-color);
}

.price-value.margin.negative {
    color: var(--danger-color);
}

.production-info {
    padding: 20px;
    background: #fef3c7;
    border-radius: 8px;
    text-align: center;
    margin-top: 20px;
}

.production-info i {
    color: var(--warning-color);
    margin-right: 10px;
}

.highlight-card {
    border: 3px solid var(--primary-color);
}

/* Examples */
.example-card .card-header {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.examples {
    display: grid;
    gap: 15px;
}

.example-item {
    padding: 15px 20px;
    background: var(--light-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid var(--success-color);
}

.example-item:hover {
    background: #dcfce7;
    transform: translateX(5px);
}

.example-item i {
    color: var(--success-color);
    margin-right: 10px;
}

/* Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Alert */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.alert i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 40px;
    opacity: 0.9;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .header,
    .footer,
    .form-actions,
    .btn {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .price-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 10px;
    }
}

/* User Info & Authentication Styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.welcome-text {
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.welcome-text i {
    font-size: 1.2rem;
}

.user-role {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: normal;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.alert i {
    font-size: 1.2rem;
}

/* Responsive adjustments for header */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-content > div:first-child {
        text-align: center;
    }
    
    .user-info {
        justify-content: center;
        width: 100%;
    }
    
    .welcome-text {
        flex-direction: column;
        text-align: center;
    }
}

