/* style.css - Family Guard Complete Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    min-height: 100vh;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 28rem;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    padding: 2rem 1.5rem;
    text-align: center;
}

.login-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.login-body {
    padding: 2rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.input-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    font-weight: 600;
    padding: 0.875rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    margin-top: 1rem;
    text-align: center;
    color: #ef4444;
    font-size: 0.875rem;
    display: none;
}

.error-message.show {
    display: block;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ============================================
   DASHBOARD STYLES
   ============================================ */

.dashboard-container {
    min-height: 100vh;
    background: #f1f5f9;
}

/* Header */
.dashboard-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.logo-text p {
    font-size: 0.7rem;
    color: #64748b;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    font-size: 0.875rem;
    color: #475569;
    font-weight: 500;
}

.logout-btn {
    font-size: 0.875rem;
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Main Content */
.main-content {
    max-width: 80rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.5rem;
}

.stat-value.online {
    color: #10b981;
}

.stat-icon {
    font-size: 1.5rem;
}

.connection-status {
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.connection-status.connected {
    color: #10b981;
}

.connection-status.disconnected {
    color: #ef4444;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

.refresh-btn {
    font-size: 0.875rem;
    color: #3b82f6;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .devices-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .devices-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.device-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.device-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 1rem;
}

.device-id {
    font-size: 0.7rem;
    color: #94a3b8;
    font-family: monospace;
    margin-top: 0.25rem;
}

.device-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-weight: 500;
}

.device-badge.online {
    background: #d1fae5;
    color: #065f46;
}

.device-badge.offline {
    background: #f1f5f9;
    color: #64748b;
}

.control-btn {
    width: 100%;
    background: #3b82f6;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.6rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.control-btn:hover {
    background: #2563eb;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
    padding: 3rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

/* Control Panel */
.control-panel {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-top: 1rem;
    display: none;
}

.control-panel.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.device-details h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

.device-details p {
    font-size: 0.7rem;
    color: #94a3b8;
    font-family: monospace;
    margin-top: 0.25rem;
}

.close-btn {
    color: #94a3b8;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f1f5f9;
    color: #475569;
}

/* Control Grid */
.control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .control-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Phone Frame */
.phone-frame {
    background: #111827;
    border-radius: 1.5rem;
    padding: 1rem;
}

.screen-label {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.screen-container {
    position: relative;
    background: black;
    border-radius: 2rem;
    overflow: hidden;
    aspect-ratio: 9 / 19.5;
}

.screen-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#touchCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.screen-status {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.7rem;
    color: #9ca3af;
}

.screen-status-live {
    color: #10b981;
}

/* Control Buttons Area */
.control-buttons-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 12rem;
}

.nav-btn {
    background: #f1f5f9;
    padding: 0.75rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.05s linear;
}

.nav-btn:active {
    background: #f59e0b;
    transform: scale(0.96);
}

.nav-btn.primary {
    background: #3b82f6;
    color: white;
}

.nav-btn.primary:active {
    background: #2563eb;
}

.system-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sys-btn {
    background: #f1f5f9;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.05s linear;
}

.sys-btn:active {
    background: #f59e0b;
    transform: scale(0.96);
}

.sys-btn.danger {
    background: #fee2e2;
    color: #dc2626;
}

.sys-btn.danger:active {
    background: #fecaca;
}

.info-tip {
    background: #eff6ff;
    border-radius: 0.75rem;
    padding: 0.75rem;
    font-size: 0.75rem;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
}

.dashboard-container {
    min-height: 100vh;
    background: #f8fafc;
}

/* Header */
.dashboard-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 95rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.logo-text p {
    font-size: 0.7rem;
    color: #64748b;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    font-size: 0.875rem;
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}

.main-content {
    max-width: 95rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.5rem;
}

.stat-value.online {
    color: #10b981;
}

.stat-icon {
    font-size: 1.5rem;
}

.connection-status {
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.connection-status.connected {
    color: #10b981;
}

.connection-status.disconnected {
    color: #ef4444;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

.refresh-btn {
    font-size: 0.875rem;
    color: #3b82f6;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* Multi Device Grid - Standard Phone Size */
.devices-multigrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .devices-multigrid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .devices-multigrid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1600px) {
    .devices-multigrid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Device Card - Each phone in its own card */
.device-card {
    background: white;
    border-radius: 1.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.device-card.active {
    border: 2px solid #3b82f6;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.device-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.device-id {
    font-size: 0.6rem;
    color: #94a3b8;
    font-family: monospace;
}

.device-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-weight: 500;
}

.device-badge.online {
    background: #d1fae5;
    color: #065f46;
}

.device-badge.offline {
    background: #f1f5f9;
    color: #64748b;
}

/* Standard Phone Frame - All phones same size */
.device-phone-frame {
    aspect-ratio: 9 / 19.5;
    border-radius: 2rem;
    border: 4px solid #1e293b;
    background: black;
    overflow: hidden;
    position: relative;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.device-screen {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.device-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.device-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: #64748b;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
}

.device-battery {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Control Buttons for each device */
.device-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.device-nav-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.device-joy-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.device-btn {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: none;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.5rem 0.8rem;
    border-radius: 1.5rem;
    cursor: pointer;
    transition: all 0.05s linear;
    min-width: 50px;
}

.device-btn:active {
    background: #f59e0b;
    transform: scale(0.94);
}

.device-btn.small {
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
    min-width: 40px;
}

.device-btn.danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.device-btn.danger:active {
    background: #ea580c;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
    padding: 3rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

/* Active control indicator */
.active-badge {
    background: #3b82f6;
    color: white;
    font-size: 0.6rem;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}