/* ==========================================================================
   Havion Media - Consolidated Styles
   Used by: Hub, Utilities, and other Havion apps
   ========================================================================== */

/* Global Styles */
* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
    padding: 10px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
}

/* ==========================================================================
   Navbar Styles
   ========================================================================== */
.navbar {
    background-color: #fff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    margin-bottom: 20px;
}

.navbar-brand {
    color: #2d3748 !important;
    font-weight: 600 !important;
}

.navbar-brand:hover {
    color: #4f46e5 !important;
}

.nav-link {
    color: #333 !important;
}

.nav-link:hover {
    color: #4f46e5 !important;
}

.navbar-text {
    color: #6b7280 !important;
}

/* ==========================================================================
   Card Styles
   ========================================================================== */
.card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
}

.card-header {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 20px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background-color: #fff;
    border-top: 1px solid #e5e7eb;
}

/* Tile-specific styles */
.tile {
    transition: all 0.2s ease;
    position: relative;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.card-accent {
    height: 4px;
    width: 100%;
}

/* ==========================================================================
   Button Styles (matching CRM)
   ========================================================================== */
.btn-primary {
    background-color: #4f46e5;
    border-color: #4f46e5;
    transition: background-color 0.2s;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #4338ca;
    border-color: #4338ca;
}

.btn-secondary {
    background-color: white;
    color: #333;
    border: 1px solid #ccc;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #f3f4f6;
    border-color: #ccc;
    color: #333;
}

.btn-success {
    background-color: #10b981;
    border-color: #10b981;
}

.btn-success:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-outline-primary {
    color: #4f46e5;
    border-color: #4f46e5;
}

.btn-outline-primary:hover {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.btn-outline-danger {
    color: #ef4444;
    border-color: #ef4444;
}

.btn-outline-danger:hover {
    background-color: #ef4444;
    border-color: #ef4444;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */
.form-control,
.form-select {
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    padding: 8px 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: #4b5563;
}

.form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

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

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-card .card {
    padding: 2rem;
}

.login-card .card-body {
    padding: 0;
}

.login-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    font-weight: 500;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* ==========================================================================
   Icon Circle
   ========================================================================== */
.icon-circle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

/* ==========================================================================
   Status Indicators
   ========================================================================== */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

/* ==========================================================================
   Badge Colors
   ========================================================================== */
.badge.bg-primary {
    background-color: #4f46e5 !important;
}

.badge.bg-success {
    background-color: #10b981 !important;
}

.badge.bg-info {
    background-color: #3b82f6 !important;
}

.badge.bg-secondary {
    background-color: #6b7280 !important;
}

.bg-purple {
    background-color: #7C3AED !important;
}

.text-purple {
    color: #7C3AED !important;
}

.text-primary {
    color: #4f46e5 !important;
}

/* ==========================================================================
   Alert Styles
   ========================================================================== */
.alert {
    border-radius: 4px;
    border: none;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ==========================================================================
   Table Styles
   ========================================================================== */
.table-responsive {
    background-color: #fff;
    border-radius: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.table {
    margin-bottom: 0;
    font-size: 13px;
}

.table th {
    background-color: #f9fafb;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 15px;
    white-space: nowrap;
}

.table td {
    padding: 8px 15px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    vertical-align: middle;
}

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

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f9fafb;
}

/* ==========================================================================
   Utilities Grid (for utilities app)
   ========================================================================== */
.utilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.utility-card {
    background-color: #fff;
    border-radius: 5px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border-left: 4px solid #4f46e5;
}

.utility-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.utility-card h3 {
    color: #1f2937;
    font-size: 1.25rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.utility-card p {
    color: #6b7280;
    margin-bottom: 15px;
    line-height: 1.6;
}

.utility-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.status-coming-soon {
    background-color: #fef3c7;
    color: #d97706;
}

.status-active {
    background-color: #d1fae5;
    color: #059669;
}

.utility-button {
    background-color: #4f46e5;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    width: 100%;
    text-align: center;
}

.utility-button:hover {
    background-color: #4338ca;
    color: white;
}

.utility-button:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */
h1 {
    margin-bottom: 10px;
    color: #2d3748;
    font-size: 1.5rem;
}

h2, h2.h4 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    margin-top: auto;
    flex-shrink: 0;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
@media screen and (max-width: 767px) {
    body {
        padding: 5px;
    }

    .navbar {
        margin-bottom: 10px;
    }

    .card-body {
        padding: 15px;
    }

    .icon-circle {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
    }

    h2.h4, h2 {
        font-size: 1.1rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-text {
        font-size: 0.8rem;
    }

    .utilities-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .utility-card {
        padding: 20px;
    }

    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Mobile form inputs */
    input[type="text"],
    input[type="email"],
    input[type="date"],
    input[type="number"],
    input[type="password"],
    textarea,
    select,
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 0;
    }

    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .icon-circle {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    h2, h2.h4 {
        font-size: 1rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media screen and (min-width: 768px) {
    body {
        padding: 20px;
    }

    .card-header {
        padding: 20px 25px;
    }

    .card-body {
        padding: 25px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .table th,
    .table td {
        padding: 12px 15px;
        font-size: 14px;
    }
}

@media screen and (min-width: 1200px) {
    .container {
        max-width: 1600px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .table-responsive {
        overflow-x: visible;
    }
}
